From 991d85a4b40c310ba4ee713ac611c30c9a61a72f Mon Sep 17 00:00:00 2001 From: kujtimiihoxha Date: Wed, 29 Oct 2025 11:34:42 +0100 Subject: [PATCH] chore: regenerate testdata --- .../anthropic-sonnet/bash_tool.yaml | 108 ++- .../anthropic-sonnet/download_tool.yaml | 134 ++-- .../anthropic-sonnet/fetch_tool.yaml | 296 -------- .../anthropic-sonnet/glob_tool.yaml | 67 +- .../anthropic-sonnet/grep_tool.yaml | 96 ++- .../anthropic-sonnet/ls_tool.yaml | 69 +- .../anthropic-sonnet/multiedit_tool.yaml | 197 +++--- .../anthropic-sonnet/parallel_tool_calls.yaml | 84 +-- .../anthropic-sonnet/read_a_file.yaml | 91 +-- .../anthropic-sonnet/simple_test.yaml | 55 +- .../anthropic-sonnet/sourcegraph_tool.yaml | 92 ++- .../anthropic-sonnet/update_a_file.yaml | 203 ++---- .../anthropic-sonnet/write_tool.yaml | 97 +-- .../openai-gpt-5/bash_tool.yaml | 170 ++--- .../openai-gpt-5/download_tool.yaml | 134 ++-- .../openai-gpt-5/fetch_tool.yaml | 255 ------- .../openai-gpt-5/glob_tool.yaml | 102 ++- .../openai-gpt-5/grep_tool.yaml | 132 ++-- .../TestCoderAgent/openai-gpt-5/ls_tool.yaml | 80 +-- .../openai-gpt-5/multiedit_tool.yaml | 486 ++++++------- .../openai-gpt-5/parallel_tool_calls.yaml | 150 ++-- .../openai-gpt-5/read_a_file.yaml | 178 ++--- .../openai-gpt-5/simple_test.yaml | 32 +- .../openai-gpt-5/sourcegraph_tool.yaml | 316 +++++---- .../openai-gpt-5/update_a_file.yaml | 400 +++++------ .../openai-gpt-5/write_tool.yaml | 132 ++-- .../openrouter-kimi-k2/bash_tool.yaml | 155 ++++- .../openrouter-kimi-k2/download_tool.yaml | 164 ++--- .../openrouter-kimi-k2/fetch_tool.yaml | 304 -------- .../openrouter-kimi-k2/glob_tool.yaml | 84 ++- .../openrouter-kimi-k2/grep_tool.yaml | 120 +++- .../openrouter-kimi-k2/ls_tool.yaml | 138 ++-- .../openrouter-kimi-k2/multiedit_tool.yaml | 652 +++++++++++------- .../parallel_tool_calls.yaml | 162 +++-- .../openrouter-kimi-k2/read_a_file.yaml | 279 ++++++-- .../openrouter-kimi-k2/simple_test.yaml | 26 +- .../openrouter-kimi-k2/sourcegraph_tool.yaml | 320 +++------ .../openrouter-kimi-k2/update_a_file.yaml | 310 +++++---- .../openrouter-kimi-k2/write_tool.yaml | 136 ++-- .../TestCoderAgent/zai-glm4.6/bash_tool.yaml | 66 +- .../zai-glm4.6/download_tool.yaml | 60 +- .../TestCoderAgent/zai-glm4.6/fetch_tool.yaml | 227 ------ .../TestCoderAgent/zai-glm4.6/glob_tool.yaml | 288 +------- .../TestCoderAgent/zai-glm4.6/grep_tool.yaml | 120 ++-- .../TestCoderAgent/zai-glm4.6/ls_tool.yaml | 180 +---- .../zai-glm4.6/multiedit_tool.yaml | 354 ++++++---- .../zai-glm4.6/parallel_tool_calls.yaml | 120 ++-- .../zai-glm4.6/read_a_file.yaml | 107 +-- .../zai-glm4.6/simple_test.yaml | 148 +--- .../zai-glm4.6/sourcegraph_tool.yaml | 404 +++++++++-- .../zai-glm4.6/update_a_file.yaml | 289 ++++---- .../TestCoderAgent/zai-glm4.6/write_tool.yaml | 60 +- 52 files changed, 4209 insertions(+), 5220 deletions(-) delete mode 100644 internal/agent/testdata/TestCoderAgent/anthropic-sonnet/fetch_tool.yaml delete mode 100644 internal/agent/testdata/TestCoderAgent/openai-gpt-5/fetch_tool.yaml delete mode 100644 internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/fetch_tool.yaml delete mode 100644 internal/agent/testdata/TestCoderAgent/zai-glm4.6/fetch_tool.yaml diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/bash_tool.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/bash_tool.yaml index 52d978111b1cbe94c1244c195743a5767ba71cc4..6edfb92bea8d6402fdd0598c45db346ac6c9cd05 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/bash_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/bash_tool.yaml @@ -25,49 +25,55 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_018vvGJgLJDHRwgcXt9xFHSn","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":152,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":3,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01JTHgJWgGQz55Gx5XkA2j1o","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":152,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":3,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Bash File"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Bash File"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Creation"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Creation"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Comman"}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Comman"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d for"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" test"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":".txt"} } event: content_block_stop - data: {"type":"content_block_stop","index":0} + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":152,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":8} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":152,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":12} } event: message_stop - data: {"type":"message_stop"} + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 725.34975ms + duration: 563.10575ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45570 + content_length: 44245 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use bash to create a file named test.txt with content 'hello bash'. do not print its timestamp\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use bash to create a file named test.txt with content 'hello bash'. do not print its timestamp\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -84,55 +90,91 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01P5Z7T9FA3Mgv91gwV19Vtm","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":12393,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":12393,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01NMi7GJLfaHmFV91s5Wchrr","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3695,"cache_read_input_tokens":8370,"cache_creation":{"ephemeral_5m_input_tokens":3695,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01DUWe86TD3JVVua1ct8twV7","name":"bash","input":{}} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01TZfhJAbLcqw2QtF4NerkGQ","name":"bash","input":{}} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"comma"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"nd\""} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \"echo 'h"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ello"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" ba"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"command\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"sh' >"}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \"ec"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" test"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ho 'hello b"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":".tx"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ash' "} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"t\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"> test.tx"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"t\"}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"descri"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ptio"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"n\": "}} + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"Create t"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"est.txt wit"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"h content"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" 'hello"}} + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" bash'\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":12393,"cache_read_input_tokens":0,"output_tokens":60} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3695,"cache_read_input_tokens":8370,"output_tokens":87} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 4.296755875s + duration: 2.513536833s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45913 + content_length: 44646 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use bash to create a file named test.txt with content 'hello bash'. do not print its timestamp\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01DUWe86TD3JVVua1ct8twV7\",\"input\":{\"command\":\"echo 'hello bash' \\u003e test.txt\"},\"name\":\"bash\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01DUWe86TD3JVVua1ct8twV7\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"no output\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use bash to create a file named test.txt with content 'hello bash'. do not print its timestamp\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01TZfhJAbLcqw2QtF4NerkGQ\",\"input\":{\"command\":\"echo 'hello bash' \\u003e test.txt\",\"description\":\"Create test.txt with content 'hello bash'\"},\"name\":\"bash\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01TZfhJAbLcqw2QtF4NerkGQ\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"no output\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -149,26 +191,26 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01RnBrJPLP8rcgvb7SHypUgS","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":72,"cache_read_input_tokens":12393,"cache_creation":{"ephemeral_5m_input_tokens":72,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_018DU3J5xKC5RMtpuaBCKrG5","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":99,"cache_read_input_tokens":12065,"cache_creation":{"ephemeral_5m_input_tokens":99,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}}} event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Done"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Done"} } event: content_block_stop data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":72,"cache_read_input_tokens":12393,"output_tokens":4} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":99,"cache_read_input_tokens":12065,"output_tokens":4} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop"} headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.2144645s + duration: 2.439063834s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/download_tool.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/download_tool.yaml index 4b66e285f42a1b0178a6276d771f58c78a2e4b3f..29a7dc40555c58f06b79b4d1abb6f898f2cd2bfb 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/download_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/download_tool.yaml @@ -25,55 +25,49 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01WC9ngFiHLQdExEcKQAtWp9","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":160,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":2,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01Pf5nC6PbAeXReViDunjYqR","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":160,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Download Example"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Downloa"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Text"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d Example"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" File"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Text"} } - event: ping - data: {"type": "ping"} + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" File"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } - - event: ping - data: {"type": "ping"} - - event: ping - data: {"type": "ping"} + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":160,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":7} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":160,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":7} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 637.960541ms + duration: 550.329333ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45595 + content_length: 44270 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -90,101 +84,77 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01Ezw4iJYqC2Y4Di2WCmFYXX","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":12401,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":12401,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01UQkzZ58TmNYzRoPL2Yd6rM","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3703,"cache_read_input_tokens":8370,"cache_creation":{"ephemeral_5m_input_tokens":3703,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01X8vwKq2Lit5t5Haf4t2FEn","name":"download","input":{}} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"url\": \"h"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ttps://examp"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"le-f"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"iles.online-"}} + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_012rqFSaRUw36cE6fBkGiJv7","name":"download","input":{}} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"conv"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ert."} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"url\": \"ht"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"com/documen"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"tps"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"t/t"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"://ex"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"xt/ex"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ample-fil"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"am"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"es.online-"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ple."} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"convert."} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"txt\""}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"com/doc"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"file_p"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"um"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ath\": \"/tmp/"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ent/t"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"crush-tes"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"xt/example."} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"t/"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"txt\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"TestCoderA"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"fil"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"gent/anthr"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"e_path"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"opic-sonne"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\": \"ex"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"t/dow"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ample"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"nloa"}} - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"d_tool/"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"example.tx"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"t\"}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":".txt\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0} + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":12401,"cache_read_input_tokens":0,"output_tokens":112} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3703,"cache_read_input_tokens":8370,"output_tokens":90} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop"} headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.79983675s + duration: 2.158027583s - id: 2 request: proto: HTTP/1.1 @@ -230,15 +200,15 @@ interactions: - text/plain; charset=UTF-8 status: 200 OK code: 200 - duration: 211.103458ms + duration: 253.501583ms - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 46140 + content_length: 44753 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01X8vwKq2Lit5t5Haf4t2FEn\",\"input\":{\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/download_tool/example.txt\",\"url\":\"https://example-files.online-convert.com/document/txt/example.txt\"},\"name\":\"download\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01X8vwKq2Lit5t5Haf4t2FEn\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"Successfully downloaded 2574 bytes to example.txt (Content-Type: text/plain; charset=UTF-8)\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_012rqFSaRUw36cE6fBkGiJv7\",\"input\":{\"file_path\":\"example.txt\",\"url\":\"https://example-files.online-convert.com/document/txt/example.txt\"},\"name\":\"download\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_012rqFSaRUw36cE6fBkGiJv7\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"Successfully downloaded 2574 bytes to example.txt (Content-Type: text/plain; charset=UTF-8)\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -255,38 +225,26 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01UbP3hQqZQLURZpDnfhx919","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":4,"cache_creation_input_tokens":148,"cache_read_input_tokens":12401,"cache_creation":{"ephemeral_5m_input_tokens":148,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_0152Wvk5bmLp3DB6M5FVgFKk","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":4,"cache_creation_input_tokens":126,"cache_read_input_tokens":12073,"cache_creation":{"ephemeral_5m_input_tokens":126,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Downloade"} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d successfully to example.txt"} } - - event: ping - data: {"type": "ping"} + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Done"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } - - event: ping - data: {"type": "ping"} - - event: ping - data: {"type": "ping"} + data: {"type":"content_block_stop","index":0} event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":4,"cache_creation_input_tokens":148,"cache_read_input_tokens":12401,"output_tokens":9} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":4,"cache_creation_input_tokens":126,"cache_read_input_tokens":12073,"output_tokens":4} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 3.225974291s + duration: 2.143742s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/fetch_tool.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/fetch_tool.yaml deleted file mode 100644 index 150030bd4f1fdffee523f2477ed451d8a91dba3a..0000000000000000000000000000000000000000 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/fetch_tool.yaml +++ /dev/null @@ -1,296 +0,0 @@ ---- -version: 2 -interactions: -- id: 0 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 844 - host: "" - body: '{"max_tokens":40,"messages":[{"content":[{"text":"Generate a concise title for the following content:\n\nfetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word ''John Doe''\n \u003cthink\u003e\n\n\u003c/think\u003e","type":"text"}],"role":"user"}],"model":"claude-3-5-haiku-20241022","system":[{"text":"you will generate a short title based on the first message a user begins a conversation with\n\n\u003crules\u003e\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\u003c/rules\u003e\n\n /no_think","type":"text"}],"stream":true}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Anthropic/Go 1.14.0 - url: https://api.anthropic.com/v1/messages - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01BRDPXhzbGHNDZaHgoYjpSL","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":167,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":3,"service_tier":"standard"}}} - - event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Fetch HTML"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" an"} } - - event: ping - data: {"type": "ping"} - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d Search"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" for John"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Doe"} } - - event: content_block_stop - data: {"type":"content_block_stop","index":0 } - - event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":167,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":12} } - - event: message_stop - data: {"type":"message_stop" } - - headers: - Content-Type: - - text/event-stream; charset=utf-8 - status: 200 OK - code: 200 - duration: 670.326292ms -- id: 1 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 45613 - host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"fetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word 'John Doe'\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Anthropic/Go 1.14.0 - url: https://api.anthropic.com/v1/messages - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01GLAoRmHdcwNMwLn7C9h1tW","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3710,"cache_read_input_tokens":8698,"cache_creation":{"ephemeral_5m_input_tokens":3710,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } - - event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_014Qt47vF2Tok18cfCa74Fk9","name":"fetch","input":{}} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"url\": \"htt"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ps://exam"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ple"}} - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"-files."} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"online"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"-conver"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"t.com/webs"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ite/ht"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ml/example"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":".h"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"tml\""} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", "} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"f"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"orm"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"at\": \"t"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ext\"}"} } - - event: content_block_stop - data: {"type":"content_block_stop","index":0 } - - event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3710,"cache_read_input_tokens":8698,"output_tokens":86} } - - event: message_stop - data: {"type":"message_stop" } - - headers: - Content-Type: - - text/event-stream; charset=utf-8 - status: 200 OK - code: 200 - duration: 2.801989083s -- id: 2 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 0 - host: example-files.online-convert.com - headers: - User-Agent: - - crush/1.0 - url: https://example-files.online-convert.com/website/html/example.html - method: GET - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - uncompressed: true - body: |- - - - - - -

HTML test file

- -

Purpose: Provide example of this file type
- Document file type: HTML
- Version: 1.0
- Remark:

- -

- - Example content:
- The names "John Doe" for males, "Jane Doe" or "Jane Roe" for females, or "Jonnie Doe" and "Janie Doe" for children, or just "Doe" non-gender-specifically are used as placeholder names for a party whose true identity is unknown or must be withheld in a legal action, case, or discussion. The names are also used to refer to acorpse or hospital patient whose identity is unknown. This practice is widely used in the United States and Canada, but is rarely used in other English-speaking countries including the United Kingdom itself, from where the use of "John Doe" in a legal context originates. The names Joe Bloggs or John Smith are used in the UK instead, as well as in Australia and New Zealand.

- -

John Doe is sometimes used to refer to a typical male in other contexts as well, in a similar manner to John Q. Public, known in Great Britain as Joe Public, John Smith or Joe Bloggs. For example, the first name listed on a form is often John Doe, along with a fictional address or other fictional information to provide an example of how to fill in the form. The name is also used frequently in popular culture, for example in the Frank Capra film Meet John Doe. John Doe was also the name of a 2002 American television series.

- -

Similarly, a child or baby whose identity is unknown may be referred to as Baby Doe. A notorious murder case in Kansas City, Missouri, referred to the baby victim as Precious Doe. Other unidentified female murder victims are Cali Doe and Princess Doe. Additional persons may be called James Doe, Judy Doe, etc. However, to avoid possible confusion, if two anonymous or unknown parties are cited in a specific case or action, the surnames Doe and Roe may be used simultaneously; for example, "John Doe v. Jane Roe". If several anonymous parties are referenced, they may simply be labelled John Doe #1, John Doe #2, etc. (the U.S. Operation Delego cited 21 (numbered) "John Doe"s) or labelled with other variants of Doe / Roe / Poe / etc. Other early alternatives such as John Stiles and Richard Miles are now rarely used, and Mary Major has been used in some American federal cases.

- -

- - File created by https://www.online-convert.com
- More example files: https://www.online-convert.com/file-type
- Text of "Example content": Wikipedia
- License: Attribution-ShareAlike 3.0 Unported - -

- -

Feel free to use and share the file according to license above.

- - - - headers: - Content-Type: - - text/html; charset=UTF-8 - status: 200 OK - code: 200 - duration: 263.552292ms -- id: 3 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 48498 - host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"fetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word 'John Doe'\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_014Qt47vF2Tok18cfCa74Fk9\",\"input\":{\"format\":\"text\",\"url\":\"https://example-files.online-convert.com/website/html/example.html\"},\"name\":\"fetch\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_014Qt47vF2Tok18cfCa74Fk9\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"HTML test file Purpose: Provide example of this file type Document file type: HTML Version: 1.0 Remark: Example content: The names \\\"John Doe\\\" for males, \\\"Jane Doe\\\" or \\\"Jane Roe\\\" for females, or \\\"Jonnie Doe\\\" and \\\"Janie Doe\\\" for children, or just \\\"Doe\\\" non-gender-specifically are used as placeholder names for a party whose true identity is unknown or must be withheld in a legal action, case, or discussion. The names are also used to refer to acorpse or hospital patient whose identity is unknown. This practice is widely used in the United States and Canada, but is rarely used in other English-speaking countries including the United Kingdom itself, from where the use of \\\"John Doe\\\" in a legal context originates. The names Joe Bloggs or John Smith are used in the UK instead, as well as in Australia and New Zealand. John Doe is sometimes used to refer to a typical male in other contexts as well, in a similar manner to John Q. Public, known in Great Britain as Joe Public, John Smith or Joe Bloggs. For example, the first name listed on a form is often John Doe, along with a fictional address or other fictional information to provide an example of how to fill in the form. The name is also used frequently in popular culture, for example in the Frank Capra film Meet John Doe. John Doe was also the name of a 2002 American television series. Similarly, a child or baby whose identity is unknown may be referred to as Baby Doe. A notorious murder case in Kansas City, Missouri, referred to the baby victim as Precious Doe. Other unidentified female murder victims are Cali Doe and Princess Doe. Additional persons may be called James Doe, Judy Doe, etc. However, to avoid possible confusion, if two anonymous or unknown parties are cited in a specific case or action, the surnames Doe and Roe may be used simultaneously; for example, \\\"John Doe v. Jane Roe\\\". If several anonymous parties are referenced, they may simply be labelled John Doe #1, John Doe #2, etc. (the U.S. Operation Delego cited 21 (numbered) \\\"John Doe\\\"s) or labelled with other variants of Doe / Roe / Poe / etc. Other early alternatives such as John Stiles and Richard Miles are now rarely used, and Mary Major has been used in some American federal cases. File created by https://www.online-convert.com More example files: https://www.online-convert.com/file-type Text of \\\"Example content\\\": Wikipedia License: Attribution-ShareAlike 3.0 Unported Feel free to use and share the file according to license above.\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - Anthropic/Go 1.14.0 - url: https://api.anthropic.com/v1/messages - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_015ADjRpDgB4Md7X9cu8d7QT","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":4,"cache_creation_input_tokens":710,"cache_read_input_tokens":12408,"cache_creation":{"ephemeral_5m_input_tokens":710,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } - - event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Yes"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":", it contains \"John Doe\" multiple"} } - - event: ping - data: {"type": "ping"} - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" times."} } - - event: ping - data: {"type": "ping"} - - event: content_block_stop - data: {"type":"content_block_stop","index":0 } - - event: ping - data: {"type": "ping"} - - event: ping - data: {"type": "ping"} - - event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":4,"cache_creation_input_tokens":710,"cache_read_input_tokens":12408,"output_tokens":15} } - - event: message_stop - data: {"type":"message_stop" } - - headers: - Content-Type: - - text/event-stream; charset=utf-8 - status: 200 OK - code: 200 - duration: 4.099359292s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/glob_tool.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/glob_tool.yaml index f62a1ec575a8ff6a8e98750e6f40dda181243546..3f11d8e88d247cf01f99813c833fbd054b873f8c 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/glob_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/glob_tool.yaml @@ -25,52 +25,52 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01JyW7ZnNKWjjHfyHNr4YYqU","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":142,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01CrzTJGVA9rY73Xv3qUFMmC","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":142,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Fin"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Fin"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d Go"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d Go"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" files with"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Files"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" glob"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Using"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" pattern"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Glob"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":142,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":9} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":142,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":9} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 845.779666ms + duration: 657.918792ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45531 + content_length: 44206 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use glob to find all .go files in the current directory\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use glob to find all .go files in the current directory\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -87,49 +87,46 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01DqD7kDSMWdJidz3Ex1yCeu","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3685,"cache_read_input_tokens":8698,"cache_creation":{"ephemeral_5m_input_tokens":3685,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_013dEUUi7Ngr8MswhttEKk8Y","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3685,"cache_read_input_tokens":8370,"cache_creation":{"ephemeral_5m_input_tokens":3685,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01H48RjyQw37JwiE43pjads4","name":"glob","input":{}} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01QmhRKmsXz762CVbWqyWw8M","name":"glob","input":{}} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"p"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"at"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"tern\": \"*."} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"patte"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"go\"}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"rn\": \"*.go\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3685,"cache_read_input_tokens":8698,"output_tokens":52}} + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3685,"cache_read_input_tokens":8370,"output_tokens":52} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.57550025s + duration: 2.534889334s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45901 + content_length: 44576 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use glob to find all .go files in the current directory\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01H48RjyQw37JwiE43pjads4\",\"input\":{\"pattern\":\"*.go\"},\"name\":\"glob\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01H48RjyQw37JwiE43pjads4\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/glob_tool/main.go\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use glob to find all .go files in the current directory\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01QmhRKmsXz762CVbWqyWw8M\",\"input\":{\"pattern\":\"*.go\"},\"name\":\"glob\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01QmhRKmsXz762CVbWqyWw8M\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/glob_tool/main.go\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -146,29 +143,29 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_012gyy7ckew56riU523vLoBA","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":86,"cache_read_input_tokens":12383,"cache_creation":{"ephemeral_5m_input_tokens":86,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01GKU8eNuRk7AXjJUfzrRmVz","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":86,"cache_read_input_tokens":12055,"cache_creation":{"ephemeral_5m_input_tokens":86,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Foun"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"main"}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d `main.go`"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":".go"} } event: content_block_stop data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":86,"cache_read_input_tokens":12383,"output_tokens":9} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":86,"cache_read_input_tokens":12055,"output_tokens":6} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.849986917s + duration: 2.496058958s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/grep_tool.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/grep_tool.yaml index ae17c7240a68c052415eab07c39230c5720f6974..d5f7bf78b8863b98655496f77188e138f5e44794 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/grep_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/grep_tool.yaml @@ -25,55 +25,52 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01ANS7svAARMMhYAVFetyTTm","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":144,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":6,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01FTPxyWDzwtZaFcS2RPUWvC","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":144,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":2,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Searching for 'package"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Searching"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"' in Go files with"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" for "} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" grep"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"'package' in Go"} } - event: ping - data: {"type": "ping"} - - event: content_block_stop - data: {"type":"content_block_stop","index":0 } + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" files with"} } - event: ping - data: {"type": "ping"} + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" grep"} } - event: ping - data: {"type": "ping"} + event: content_block_stop + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":144,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":15} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":144,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":15} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 720.443917ms + duration: 546.96425ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45529 + content_length: 44204 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use grep to search for the word 'package' in go files\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use grep to search for the word 'package' in go files\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -90,61 +87,55 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01R8wxsc2pzMYDmiiMzQJC5b","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3687,"cache_read_input_tokens":8698,"cache_creation":{"ephemeral_5m_input_tokens":3687,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_017k4EhciL2iaf1CHTNzFtwq","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3687,"cache_read_input_tokens":8370,"cache_creation":{"ephemeral_5m_input_tokens":3687,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_015tBLUXrJN88Ro522WwXyjU","name":"grep","input":{}} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01BzVgJQ1Gsw2d75dsuYjw6b","name":"grep","input":{}} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"patt"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ern"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"pattern\": "} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\":"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"pack"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" \"pack"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"age\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"age"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"incl"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ude\": \"*"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"incl"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ude\": \"*.go\"}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":".go\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3687,"cache_read_input_tokens":8698,"output_tokens":69} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3687,"cache_read_input_tokens":8370,"output_tokens":69} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.556562791s + duration: 2.35918275s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45971 + content_length: 44646 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use grep to search for the word 'package' in go files\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_015tBLUXrJN88Ro522WwXyjU\",\"input\":{\"include\":\"*.go\",\"pattern\":\"package\"},\"name\":\"grep\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_015tBLUXrJN88Ro522WwXyjU\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"Found 1 matches\\n/tmp/crush-test/TestCoderAgent/anthropic-sonnet/grep_tool/main.go:\\n Line 1, Char 1: package main\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use grep to search for the word 'package' in go files\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01BzVgJQ1Gsw2d75dsuYjw6b\",\"input\":{\"include\":\"*.go\",\"pattern\":\"package\"},\"name\":\"grep\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01BzVgJQ1Gsw2d75dsuYjw6b\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"Found 1 matches\\n/tmp/crush-test/TestCoderAgent/anthropic-sonnet/grep_tool/main.go:\\n Line 1, Char 1: package main\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -161,38 +152,35 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01GQ6vGSVrxCcbNWVRRqTiFa","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":125,"cache_read_input_tokens":12385,"cache_creation":{"ephemeral_5m_input_tokens":125,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01GZGpNYwPeUCNQLMZ9ayV1h","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":125,"cache_read_input_tokens":12057,"cache_creation":{"ephemeral_5m_input_tokens":125,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Foun"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Foun"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d 1 match in main.go at line 1."} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d 1 match in `main.go:"} } event: ping data: {"type": "ping"} - event: content_block_stop - data: {"type":"content_block_stop","index":0 } - - event: ping - data: {"type": "ping"} + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"1` containing \"package main\"."}} - event: ping - data: {"type": "ping"} + event: content_block_stop + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":125,"cache_read_input_tokens":12385,"output_tokens":17} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":125,"cache_read_input_tokens":12057,"output_tokens":21} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.817417667s + duration: 2.094343125s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/ls_tool.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/ls_tool.yaml index d117db82af732873947457c0b563be2f5072c223..859dbe1283cfbfb67dbc4cd121de595819526e48 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/ls_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/ls_tool.yaml @@ -25,46 +25,49 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01BNFzNWD2kzAnPn5YweshvD","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":140,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":2,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_014VzajaowaWgHByMxWPPK55","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":140,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":3,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Listing"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Listing Files"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Files"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" in Current Directory"} } event: ping data: {"type": "ping"} - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" in Current Directory"}} - event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } + + event: ping + data: {"type": "ping"} + + event: ping + data: {"type": "ping"} event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":140,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":9} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":140,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":9}} event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.012243208s + duration: 588.545542ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45523 + content_length: 44198 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use ls to list the files in the current directory\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use ls to list the files in the current directory\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -81,37 +84,37 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01EFyNiZUCpxh9amK4XWuXdE","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3683,"cache_read_input_tokens":8698,"cache_creation":{"ephemeral_5m_input_tokens":3683,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01LkrfjYwfNZ5W2ijUAMdfkf","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3683,"cache_read_input_tokens":8370,"cache_creation":{"ephemeral_5m_input_tokens":3683,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_013DGxjRNi8WvLnY2tNSy1wy","name":"ls","input":{}} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01NMRsDUTZorMG3CU1GtJvZV","name":"ls","input":{}} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3683,"cache_read_input_tokens":8698,"output_tokens":34} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3683,"cache_read_input_tokens":8370,"output_tokens":34} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 3.163504s + duration: 2.135258417s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45897 + content_length: 44572 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use ls to list the files in the current directory\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_013DGxjRNi8WvLnY2tNSy1wy\",\"input\":{},\"name\":\"ls\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_013DGxjRNi8WvLnY2tNSy1wy\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\n- /tmp/crush-test/TestCoderAgent/anthropic-sonnet/ls_tool/\\n - go.mod\\n - main.go\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use ls to list the files in the current directory\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01NMRsDUTZorMG3CU1GtJvZV\",\"input\":{},\"name\":\"ls\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01NMRsDUTZorMG3CU1GtJvZV\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\n- /tmp/crush-test/TestCoderAgent/anthropic-sonnet/ls_tool/\\n - go.mod\\n - main.go\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -128,28 +131,22 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01BgX1sMzvADoPJBrVsMyo67","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":81,"cache_read_input_tokens":12381,"cache_creation":{"ephemeral_5m_input_tokens":81,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01K4hwJCFw76W8trWUu5tqSf","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":81,"cache_read_input_tokens":12053,"cache_creation":{"ephemeral_5m_input_tokens":81,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}}} event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"go"} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":".mod an"} } - - event: ping - data: {"type": "ping"} + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"go"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d main.go"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":".mod, main.go"} } event: ping data: {"type": "ping"} event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: ping data: {"type": "ping"} @@ -158,14 +155,14 @@ interactions: data: {"type": "ping"} event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":81,"cache_read_input_tokens":12381,"output_tokens":10} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":81,"cache_read_input_tokens":12053,"output_tokens":10} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 4.395312583s + duration: 2.461765125s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/multiedit_tool.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/multiedit_tool.yaml index bc995ced9347b08fa7e63f27281da7c428fd03f8..2fe73a65b94b74417c796f4d87c6d18997d9beea 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/multiedit_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/multiedit_tool.yaml @@ -25,49 +25,49 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01QY6iFxXLQNuLLZhBYyPPrj","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":170,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":2,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01A8kj3YE3D9N8qWRrvDFNHJ","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":170,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":2,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Modify"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Modify"}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Greeting in"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Greeting in"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Go"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Go"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Program"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Program"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":170,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":10} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":170,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":10} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 570.817375ms + duration: 841.00425ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45609 + content_length: 44284 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -84,100 +84,103 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_014RABPgpPoGLETQxB4WUJnY","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3715,"cache_read_input_tokens":8698,"cache_creation":{"ephemeral_5m_input_tokens":3715,"ephemeral_1h_input_tokens":0},"output_tokens":3,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01SYEMbQvGdGyHmNw9Pg1TMJ","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3715,"cache_read_input_tokens":8370,"cache_creation":{"ephemeral_5m_input_tokens":3715,"ephemeral_1h_input_tokens":0},"output_tokens":3,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"I'll rea"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"I'll rea"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d the file first to see its"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d the file first to see"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" exact structure."} } - - event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" the exact"} } - event: content_block_start - data: {"type":"content_block_start","index":1,"content_block":{"type":"tool_use","id":"toolu_015AieACzRpxDZ1bYKTeKsuj","name":"view","input":{}} } + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" formatting, then use"}} event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" multiedit to make both"} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"{\"file_pa"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" changes."} } + + event: content_block_stop + data: {"type":"content_block_stop","index":0 } + + event: content_block_start + data: {"type":"content_block_start","index":1,"content_block":{"type":"tool_use","id":"toolu_01NJ9dz6zosqxE9fLVug8obZ","name":"view","input":{}} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"th\": \""} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"/tmp"} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"{\"file_pat"} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"/crush-"} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"h\": \"/tmp/c"} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"te"} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"rus"} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"st/TestCod"} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"h-tes"} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"erAgent/an"} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"t/TestCod"} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"th"} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"er"} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"ropic-sonne"} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"Agent"} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"t/m"}} + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"/a"} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"ulti"} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"nthropic-so"} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"ed"} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"nnet/multied"} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"it_to"} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"it_tool"} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"ol/main.go"} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"/ma"} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"\"}"} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"in.go\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":1 } + data: {"type":"content_block_stop","index":1 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3715,"cache_read_input_tokens":8698,"output_tokens":92} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3715,"cache_read_input_tokens":8370,"output_tokens":102} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.961919125s + duration: 2.450759875s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 46232 + content_length: 44949 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"text\":\"I'll read the file first to see its exact structure.\",\"type\":\"text\"},{\"id\":\"toolu_015AieACzRpxDZ1bYKTeKsuj\",\"input\":{\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool/main.go\"},\"name\":\"view\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_015AieACzRpxDZ1bYKTeKsuj\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cfile\\u003e\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\u003c/file\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"text\":\"I'll read the file first to see the exact formatting, then use multiedit to make both changes.\",\"type\":\"text\"},{\"id\":\"toolu_01NJ9dz6zosqxE9fLVug8obZ\",\"input\":{\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool/main.go\"},\"name\":\"view\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01NJ9dz6zosqxE9fLVug8obZ\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cfile\\u003e\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\u003c/file\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -194,142 +197,148 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01379iznULpps5tjCkRkLYwV","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":156,"cache_read_input_tokens":12413,"cache_creation":{"ephemeral_5m_input_tokens":156,"ephemeral_1h_input_tokens":0},"output_tokens":28,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01FKsCBeDnHj6hnLspDjfYKb","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":166,"cache_read_input_tokens":12085,"cache_creation":{"ephemeral_5m_input_tokens":166,"ephemeral_1h_input_tokens":0},"output_tokens":28,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01G2XxcamQ9G53yojKEFjHZj","name":"multiedit","input":{}} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01FGmpmHqNthvkK63gnRJn95","name":"multiedit","input":{}} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"file_path\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"file_pat"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \"/t"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"h\": \""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"mp/"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"/t"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"crush-test/T"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"mp/crush-tes"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"es"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"t/TestCoder"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"tCoder"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"Ag"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"Agent/an"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ent/anthro"}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"thropic-so"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"pic-sonnet/m"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"nnet/"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ultiedit_t"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"multiedit_"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"oo"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"tool/ma"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"l/m"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"in.go\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ain.go\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"edits\": ["} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"edits\": ["}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\""}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"old_str"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"old_s"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"in"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"tring\":\"fu"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"g\":\"func mai"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"nc mai"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"n("} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"n() {"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":") {\\n\\tfmt.P"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\\n"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"rintln(\\"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\\tfmt."} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"Hel"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"Pri"}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"lo, Worl"}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ntln(\\"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"d!\\\")"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"Hello,"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\",\"new_str"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" World!\\\")"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ing\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\\n}\","} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":":\"f"}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"new_strin"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"unc "} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"g\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"main() {\\n"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":":\"fun"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\\t//"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"c main()"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" Greetin"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" {\\n\\t// Gre"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"g\\n\\tf"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"eting\\n\\tf"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"mt.Println(\\"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"mt.P"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"Hel"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"rintln(\\"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"lo, Cru"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"Hello"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"sh!\\\")\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", C"}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"}]}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"rush!\\\")\\"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"n}\"}]}"} } event: content_block_stop data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":156,"cache_read_input_tokens":12413,"output_tokens":171} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":166,"cache_read_input_tokens":12085,"output_tokens":176} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 3.469988291s + duration: 2.495149667s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 46864 + content_length: 45587 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"text\":\"I'll read the file first to see its exact structure.\",\"type\":\"text\"},{\"id\":\"toolu_015AieACzRpxDZ1bYKTeKsuj\",\"input\":{\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool/main.go\"},\"name\":\"view\",\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_015AieACzRpxDZ1bYKTeKsuj\",\"content\":[{\"text\":\"\\u003cfile\\u003e\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\u003c/file\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01G2XxcamQ9G53yojKEFjHZj\",\"input\":{\"edits\":[{\"new_string\":\"func main() {\\n\\t// Greeting\\n\\tfmt.Println(\\\"Hello, Crush!\\\")\",\"old_string\":\"func main() {\\n\\tfmt.Println(\\\"Hello, World!\\\")\"}],\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool/main.go\"},\"name\":\"multiedit\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01G2XxcamQ9G53yojKEFjHZj\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cresult\\u003e\\nApplied 1 edits to file: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool/main.go\\n\\u003c/result\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"text\":\"I'll read the file first to see the exact formatting, then use multiedit to make both changes.\",\"type\":\"text\"},{\"id\":\"toolu_01NJ9dz6zosqxE9fLVug8obZ\",\"input\":{\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool/main.go\"},\"name\":\"view\",\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01NJ9dz6zosqxE9fLVug8obZ\",\"content\":[{\"text\":\"\\u003cfile\\u003e\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\u003c/file\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01FGmpmHqNthvkK63gnRJn95\",\"input\":{\"edits\":[{\"new_string\":\"func main() {\\n\\t// Greeting\\n\\tfmt.Println(\\\"Hello, Crush!\\\")\\n}\",\"old_string\":\"func main() {\\n\\tfmt.Println(\\\"Hello, World!\\\")\\n}\"}],\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool/main.go\"},\"name\":\"multiedit\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01FGmpmHqNthvkK63gnRJn95\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cresult\\u003e\\nApplied 1 edits to file: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool/main.go\\n\\u003c/result\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -346,26 +355,26 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01N4aaCyWyWsTLhLQAJYQXRU","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":216,"cache_read_input_tokens":12569,"cache_creation":{"ephemeral_5m_input_tokens":216,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01XsNZcLvgAAQNN1XYjjX51Y","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":221,"cache_read_input_tokens":12251,"cache_creation":{"ephemeral_5m_input_tokens":221,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Done"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Done"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":216,"cache_read_input_tokens":12569,"output_tokens":4} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":221,"cache_read_input_tokens":12251,"output_tokens":4} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.446939125s + duration: 2.485877792s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/parallel_tool_calls.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/parallel_tool_calls.yaml index 7c4e3a2c2d2bc77d64e12be0be1902ed3afe68b7..670413ea6632f5e44ac2f3d4a932820130172fa1 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/parallel_tool_calls.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/parallel_tool_calls.yaml @@ -25,49 +25,49 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01QLJQGk8HupwYPrdhAENEqs","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":159,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":2,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01WWaP9Gqe3fuPVn7yDeohTS","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":159,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":2,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Parallel"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Parallel"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Go File"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Go File"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Glob and Directory"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Search and Directory"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Listing"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Listing"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":159,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":13} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":159,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":12}} event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.296836708s + duration: 524.640917ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45620 + content_length: 44295 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -84,61 +84,64 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01KzY6wuDgoZUimsNBkpTfDE","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3704,"cache_read_input_tokens":8698,"cache_creation":{"ephemeral_5m_input_tokens":3704,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01BNVPuyt6VKT8hmqvzwP9Pg","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3704,"cache_read_input_tokens":8370,"cache_creation":{"ephemeral_5m_input_tokens":3704,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01XXTH5kHpK6Zdbn2ME671mC","name":"glob","input":{}} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01DZhnYNiy52853RCMZmfvZz","name":"glob","input":{}} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"pattern\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"pattern"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \""}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\": \"**/*"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"**/*."} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":".go\"}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"go\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: content_block_start - data: {"type":"content_block_start","index":1,"content_block":{"type":"tool_use","id":"toolu_01YAqc9JDMF2JvUde7WxZpEp","name":"ls","input":{}} } + data: {"type":"content_block_start","index":1,"content_block":{"type":"tool_use","id":"toolu_01CBw5jT32nvgmori4jeAf69","name":"ls","input":{}} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":""}} event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"{\"path\""} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"{\"pat"} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":": \".\"}"} } + data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"h\": \".\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":1 } + data: {"type":"content_block_stop","index":1 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3704,"cache_read_input_tokens":8698,"output_tokens":86} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3704,"cache_read_input_tokens":8370,"output_tokens":86} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.612875917s + duration: 2.217387584s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 46301 + content_length: 44976 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01XXTH5kHpK6Zdbn2ME671mC\",\"input\":{\"pattern\":\"**/*.go\"},\"name\":\"glob\",\"type\":\"tool_use\"},{\"id\":\"toolu_01YAqc9JDMF2JvUde7WxZpEp\",\"input\":{\"path\":\".\"},\"name\":\"ls\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01XXTH5kHpK6Zdbn2ME671mC\",\"content\":[{\"text\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/parallel_tool_calls/main.go\",\"type\":\"text\"}],\"type\":\"tool_result\"},{\"tool_use_id\":\"toolu_01YAqc9JDMF2JvUde7WxZpEp\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\n- /tmp/crush-test/TestCoderAgent/anthropic-sonnet/parallel_tool_calls/\\n - go.mod\\n - main.go\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01DZhnYNiy52853RCMZmfvZz\",\"input\":{\"pattern\":\"**/*.go\"},\"name\":\"glob\",\"type\":\"tool_use\"},{\"id\":\"toolu_01CBw5jT32nvgmori4jeAf69\",\"input\":{\"path\":\".\"},\"name\":\"ls\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01DZhnYNiy52853RCMZmfvZz\",\"content\":[{\"text\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/parallel_tool_calls/main.go\",\"type\":\"text\"}],\"type\":\"tool_result\"},{\"tool_use_id\":\"toolu_01CBw5jT32nvgmori4jeAf69\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\n- /tmp/crush-test/TestCoderAgent/anthropic-sonnet/parallel_tool_calls/\\n - go.mod\\n - main.go\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -155,41 +158,38 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01BYyDmNqxn81NhfYy17tZDy","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":6,"cache_creation_input_tokens":207,"cache_read_input_tokens":12402,"cache_creation":{"ephemeral_5m_input_tokens":207,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01UrLn47FnwNzQyr1N1RxDRo","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":6,"cache_creation_input_tokens":207,"cache_read_input_tokens":12074,"cache_creation":{"ephemeral_5m_input_tokens":207,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Foun"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Foun"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d one Go file ("} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d one Go file: `main.go`. Directory"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"main.go) in"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" the directory containing go.mod an"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" contains `go.mod` and `main"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d main.go."} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":".go`."} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":6,"cache_creation_input_tokens":207,"cache_read_input_tokens":12402,"output_tokens":24} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":6,"cache_creation_input_tokens":207,"cache_read_input_tokens":12074,"output_tokens":26}} event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 3.748746042s + duration: 2.441062292s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/read_a_file.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/read_a_file.yaml index d727d46a9f910edd157c519da568614c80a7e06d..c7a20c7b46dcec3eda109208d6e2ba5afe991791 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/read_a_file.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/read_a_file.yaml @@ -25,31 +25,31 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01TSuuNRcdWrv4YQYCMEMnFi","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":134,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01F7Ks6hvtV8tAaPJ1vXNAeK","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":134,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Rea"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Rea"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d Go"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d Go"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Module"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Module"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Details"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Details"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":134,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":7} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":134,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":7} } event: message_stop data: {"type":"message_stop" } @@ -59,15 +59,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 715.464792ms + duration: 722.977625ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45493 + content_length: 44168 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"Read the go mod\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"Read the go mod\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -84,70 +84,73 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01HqEnzZXVHP55EqUmZmtvvQ","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3679,"cache_read_input_tokens":8698,"cache_creation":{"ephemeral_5m_input_tokens":3679,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_019WP3EMAQybBZRTNup4m6Vj","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3679,"cache_read_input_tokens":8370,"cache_creation":{"ephemeral_5m_input_tokens":3679,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01QtYzskyEeTUvAmuz9MUmbc","name":"view","input":{}} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01VrjfyaPEHswTNShArkFpVF","name":"view","input":{}} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"file_p"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"fil"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ath\": \"/tmp"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"e_path\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"/crush"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \"/tmp/"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"-test/Test"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"crush-te"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"Coder"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"st/TestCod"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"Agent/anth"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"erAgen"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"rop"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"t/anth"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ic-"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ropic-sonnet"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"sonnet/read_"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"/re"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"a_file"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ad_a_f"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"/go.mod\"}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ile/go.mo"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"d\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3679,"cache_read_input_tokens":8698,"output_tokens":79} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3679,"cache_read_input_tokens":8370,"output_tokens":79} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop"} headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 3.398298s + duration: 2.118783958s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45963 + content_length: 44638 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"Read the go mod\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01QtYzskyEeTUvAmuz9MUmbc\",\"input\":{\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/read_a_file/go.mod\"},\"name\":\"view\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01QtYzskyEeTUvAmuz9MUmbc\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cfile\\u003e\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\u003c/file\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"Read the go mod\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01VrjfyaPEHswTNShArkFpVF\",\"input\":{\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/read_a_file/go.mod\"},\"name\":\"view\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01VrjfyaPEHswTNShArkFpVF\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cfile\\u003e\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\u003c/file\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -164,38 +167,38 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01PYtNNfV9RBwNVDmqRrFFJr","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":120,"cache_read_input_tokens":12377,"cache_creation":{"ephemeral_5m_input_tokens":120,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_0158tPRn8ZXUJB6Nqm9GijVj","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":120,"cache_read_input_tokens":12049,"cache_creation":{"ephemeral_5m_input_tokens":120,"ephemeral_1h_input_tokens":0},"output_tokens":2,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Module"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"The module"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" `example.com/testproject`,"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" is `example.com/testproject` running Go 1.23."} } event: ping data: {"type": "ping"} - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Go 1.23,"} } + event: content_block_stop + data: {"type":"content_block_stop","index":0 } - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" no dependencies."} } + event: ping + data: {"type": "ping"} - event: content_block_stop - data: {"type":"content_block_stop","index":0} + event: ping + data: {"type": "ping"} event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":120,"cache_read_input_tokens":12377,"output_tokens":21} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":120,"cache_read_input_tokens":12049,"output_tokens":21} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.586336958s + duration: 2.207103042s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/simple_test.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/simple_test.yaml index 4ff5caae4c803b094dc5b3f015e9b60b5d71512f..c24de9d5ca2abefdacd8196f0c8891b256528644 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/simple_test.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/simple_test.yaml @@ -25,37 +25,49 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01WZWJDPKKADvmCVs9XebStk","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":131,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":2,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_012gsHUxRRVBcbcpWbt4jVDq","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":131,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Greeting"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Quick"} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Greeting"} } + + event: ping + data: {"type": "ping"} event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } + + event: ping + data: {"type": "ping"} + + event: ping + data: {"type": "ping"} event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":131,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":5} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":131,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":6} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.241140167s + duration: 782.872416ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45483 + content_length: 44158 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"Hello\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/simple_test\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"Hello\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/simple_test\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -72,38 +84,29 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_013QAzihWna5SLQTJWwsT8iE","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":12372,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":12372,"ephemeral_1h_input_tokens":0},"output_tokens":3,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_016WFKxabQBQVvghd3x8ZKVP","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":12044,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":12044,"ephemeral_1h_input_tokens":0},"output_tokens":3,"service_tier":"standard"}}} event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello! How"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello! How"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" can I help you today?"} } - - event: ping - data: {"type": "ping"} + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" can I help you today?"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } - - event: ping - data: {"type": "ping"} - - event: ping - data: {"type": "ping"} + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":12372,"cache_read_input_tokens":0,"output_tokens":12} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":12044,"cache_read_input_tokens":0,"output_tokens":12} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 6.989039125s + duration: 2.784341084s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/sourcegraph_tool.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/sourcegraph_tool.yaml index 06421f33dbe09f640ca5765f019b4e47bc7938c0..24a2ada741938467d5168643a2e1644a607ab0e7 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/sourcegraph_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/sourcegraph_tool.yaml @@ -25,49 +25,49 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01YZpsBGrkEqikV1yyBPNcsV","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":145,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":5,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01M9FMyDRvFD7dDeaxGBdy9A","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":145,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":3,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Sourcegraph Go"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Searching Go"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Main"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Repos"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Function"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" for main"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Search"}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Functions"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":145,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":11} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":145,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":11} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 750.301125ms + duration: 1.069022542s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45543 + content_length: 44218 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use sourcegraph to search for 'func main' in Go repositories\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use sourcegraph to search for 'func main' in Go repositories\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -84,47 +84,44 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_014EgXCQ4A6vUjfXbULw1j71","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3690,"cache_read_input_tokens":8698,"cache_creation":{"ephemeral_5m_input_tokens":3690,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}}} + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01QySyZngwndwoApMakdTdWb","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3690,"cache_read_input_tokens":8370,"cache_creation":{"ephemeral_5m_input_tokens":3690,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01Rwk1ZVRsTDmmTbu4QfNe5J","name":"sourcegraph","input":{}} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01TbkAdDYn4VZNWpiGUZAQCP","name":"sourcegraph","input":{}} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"query\": \"l"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ang:"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"query\": \""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"go func "} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"lang:go fu"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"main\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"nc main\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"cou"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"count\": "} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"nt\": 10}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"20}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3690,"cache_read_input_tokens":8698,"output_tokens":74} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3690,"cache_read_input_tokens":8370,"output_tokens":74} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 3.204232459s + duration: 5.1822605s - id: 2 request: proto: HTTP/1.1 @@ -152,15 +149,15 @@ interactions: - application/json status: 200 OK code: 200 - duration: 1.557855083s + duration: 6.319206917s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 53418 + content_length: 52093 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use sourcegraph to search for 'func main' in Go repositories\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01Rwk1ZVRsTDmmTbu4QfNe5J\",\"input\":{\"count\":10,\"query\":\"lang:go func main\"},\"name\":\"sourcegraph\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01Rwk1ZVRsTDmmTbu4QfNe5J\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"# Sourcegraph Search Results\\n\\nFound 30 matches across 30 results\\n(Result limit reached, try a more specific query)\\n\\n## Result 1: github.com/jcalabro/uscope/assets/gobacktrace/main.go\\n\\nURL: /github.com/jcalabro/uscope/-/blob/assets/gobacktrace/main.go\\n\\n```\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| func main() {\\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| \\tFuncA()\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncB()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncC()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncD()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncE()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncF()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| func FuncE() {\\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| \\tfmt.Println(\\\"FuncE\\\")\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| func FuncD() {\\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| \\tFuncE()\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tfmt.Println(\\\"FuncD\\\")\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n```\\n\\n```\\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| func FuncC() {\\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n```\\n\\n```\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| \\tFuncD()\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n```\\n\\n```\\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tfmt.Println(\\\"FuncC\\\")\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n```\\n\\n```\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| func FuncB() {\\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n```\\n\\n```\\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| \\tFuncC()\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n```\\n\\n```\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tfmt.Println(\\\"FuncB\\\")\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n```\\n\\n```\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| func FuncA() {\\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n```\\n\\n```\\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| \\tFuncB()\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n```\\n\\n```\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tfmt.Println(\\\"FuncA\\\")\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n```\\n\\n```\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| func FuncF() {\\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n```\\n\\n```\\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| \\tfmt.Println(\\\"FuncF\\\")\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n```\\n\\n```\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tFuncE()\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n```\\n\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use sourcegraph to search for 'func main' in Go repositories\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01TbkAdDYn4VZNWpiGUZAQCP\",\"input\":{\"count\":20,\"query\":\"lang:go func main\"},\"name\":\"sourcegraph\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01TbkAdDYn4VZNWpiGUZAQCP\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"# Sourcegraph Search Results\\n\\nFound 30 matches across 30 results\\n(Result limit reached, try a more specific query)\\n\\n## Result 1: github.com/jcalabro/uscope/assets/gobacktrace/main.go\\n\\nURL: /github.com/jcalabro/uscope/-/blob/assets/gobacktrace/main.go\\n\\n```\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| func main() {\\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| \\tFuncA()\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncB()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncC()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncD()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncE()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncF()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| func FuncE() {\\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| \\tfmt.Println(\\\"FuncE\\\")\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| func FuncD() {\\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| \\tFuncE()\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tfmt.Println(\\\"FuncD\\\")\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n```\\n\\n```\\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| func FuncC() {\\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n```\\n\\n```\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| \\tFuncD()\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n```\\n\\n```\\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tfmt.Println(\\\"FuncC\\\")\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n```\\n\\n```\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| func FuncB() {\\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n```\\n\\n```\\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| \\tFuncC()\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n```\\n\\n```\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tfmt.Println(\\\"FuncB\\\")\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n```\\n\\n```\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| func FuncA() {\\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n```\\n\\n```\\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| \\tFuncB()\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n```\\n\\n```\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tfmt.Println(\\\"FuncA\\\")\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n```\\n\\n```\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| func FuncF() {\\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n```\\n\\n```\\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| \\tfmt.Println(\\\"FuncF\\\")\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n```\\n\\n```\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tFuncE()\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n```\\n\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -177,59 +174,56 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01RSQQ9vJTVmTPqk1p3Q4Ure","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":3890,"cache_read_input_tokens":12388,"cache_creation":{"ephemeral_5m_input_tokens":3890,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01VxxqDDZb2TcQmoJpZkoyXA","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":3890,"cache_read_input_tokens":12060,"cache_creation":{"ephemeral_5m_input_tokens":3890,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Foun"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Foun"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d 30 matches for"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d 30 matches for"} } event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" 'func main' in"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" `func main` in Go repositories. The"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Go repositories. Here's the primary"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" results show various main function implementations,"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" match from github.com/jcalabro"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" primarily from github.com/jcalabro"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"/uscope at"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"/uscope/assets/go"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" line 34 of assets"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"backtrace/main.go."} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"/gobacktrace/main."} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" The code demonstrates a typical Go main package"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"go showing a main"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" with multiple helper functions (FuncA-FuncF)"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" function that calls several other functions ("} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"FuncA through FuncF)."} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" being called from the main entry point."} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":3890,"cache_read_input_tokens":12388,"output_tokens":71} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":3890,"cache_read_input_tokens":12060,"output_tokens":81} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.336092417s + duration: 2.788693542s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/update_a_file.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/update_a_file.yaml index 0a0aede7178c5bfa193184ba8585d986673eb158..17789fca89f42609267798aa8a10f0d39b337860 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/update_a_file.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/update_a_file.yaml @@ -25,49 +25,49 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01H2zZJHC8GovvETy9DLVgYC","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":145,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01VcFaoW2H1LocUHpbozfweA","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":145,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Update"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Update"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" main"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" main"}} event: ping data: {"type": "ping"} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":".go Hello"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":".go Hello"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Greeting"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" Message"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":145,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":10} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":145,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":9} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.593052292s + duration: 636.163792ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45549 + content_length: 44224 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"update the main.go file by changing the print to say hello from crush\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"update the main.go file by changing the print to say hello from crush\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -84,100 +84,46 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01ENgykARQbZLAfdytxAEqao","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3690,"cache_read_input_tokens":8698,"cache_creation":{"ephemeral_5m_input_tokens":3690,"ephemeral_1h_input_tokens":0},"output_tokens":3,"service_tier":"standard"}} } - - event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"I'll rea"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"d the file first,"} } - - event: ping - data: {"type": "ping"} - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" then update it."} } - - event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_016KoEg6EgVXQpFAdyqV4vVA","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3690,"cache_read_input_tokens":8370,"cache_creation":{"ephemeral_5m_input_tokens":3690,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}}} event: content_block_start - data: {"type":"content_block_start","index":1,"content_block":{"type":"tool_use","id":"toolu_016p1QEjC2t85XU9xAQVJsp2","name":"view","input":{}} } - - event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":""} } - - event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"{\"f"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"il"}} - - event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"e_path\":"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":" \"/tm"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"p/cru"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"sh-tes"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"t/TestCoder"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"Agent/anth"}} - - event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"ropic-son"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"net/"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"update"} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_014B6GpHgUPh5aunbj68jSZf","name":"view","input":{}} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"_a_file/"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"ma"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"file_pa"}} event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"in.go"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"th\": "} } event: content_block_delta - data: {"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"\"}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"main.go\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":1 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3690,"cache_read_input_tokens":8698,"output_tokens":91} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3690,"cache_read_input_tokens":8370,"output_tokens":55} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.751573709s + duration: 5.713480375s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 46160 + content_length: 44706 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"update the main.go file by changing the print to say hello from crush\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"text\":\"I'll read the file first, then update it.\",\"type\":\"text\"},{\"id\":\"toolu_016p1QEjC2t85XU9xAQVJsp2\",\"input\":{\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file/main.go\"},\"name\":\"view\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_016p1QEjC2t85XU9xAQVJsp2\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cfile\\u003e\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\u003c/file\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"update the main.go file by changing the print to say hello from crush\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_014B6GpHgUPh5aunbj68jSZf\",\"input\":{\"file_path\":\"main.go\"},\"name\":\"view\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_014B6GpHgUPh5aunbj68jSZf\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cfile\\u003e\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\u003c/file\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -194,133 +140,118 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01QEXX1dVknh5nbN2oqQrn5T","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":155,"cache_read_input_tokens":12388,"cache_creation":{"ephemeral_5m_input_tokens":155,"ephemeral_1h_input_tokens":0},"output_tokens":18,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01Fwn6caTsewkFBMCZgaBGpH","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":120,"cache_read_input_tokens":12060,"cache_creation":{"ephemeral_5m_input_tokens":120,"ephemeral_1h_input_tokens":0},"output_tokens":48,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01QZMh8Q3YHr4KMqzYJx5MfX","name":"edit","input":{}} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01JLieGu2SvbZnaKsfaNiH8q","name":"edit","input":{}} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"fil"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"file_p"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"e_path\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ath"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \"/"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\": \""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"tmp/crush"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"main."} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"-test/TestCo"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"go\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"derAg"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ent/anthro"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"old_string\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"pic-sonnet/"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \"fu"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"upda"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"nc main()"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"te_a_file/ma"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" {\\n\\tfmt.Pr"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"in."} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"intl"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"go\""}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"n(\\"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"old_stri"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"Hell"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ng\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"o, World!"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \"func mai"}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\\\")\\"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"n() {\\n\\tfmt"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"n}\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":".Print"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"ne"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ln(\\\"Hello, "} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"w_str"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"Worl"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ing\":"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"d!\\\")"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" \"func main("} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\\n}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":") {\\n\\tfmt."} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"Pri"}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", "} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ntln(\\\"hell"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"new_s"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"o f"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"tring\": \"f"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"rom crush"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"unc ma"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\\\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"in() {\\n\\t"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"fmt.Println"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"(\\"} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"hello "} } - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"from crus"}} - - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"h\\\")\\n}\"}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":")\\n}\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":155,"cache_read_input_tokens":12388,"output_tokens":147} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":120,"cache_read_input_tokens":12060,"output_tokens":123} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.706772375s + duration: 3.133288833s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 46768 + content_length: 45252 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"update the main.go file by changing the print to say hello from crush\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"text\":\"I'll read the file first, then update it.\",\"type\":\"text\"},{\"id\":\"toolu_016p1QEjC2t85XU9xAQVJsp2\",\"input\":{\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file/main.go\"},\"name\":\"view\",\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_016p1QEjC2t85XU9xAQVJsp2\",\"content\":[{\"text\":\"\\u003cfile\\u003e\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\u003c/file\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01QZMh8Q3YHr4KMqzYJx5MfX\",\"input\":{\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file/main.go\",\"new_string\":\"func main() {\\n\\tfmt.Println(\\\"hello from crush\\\")\\n}\",\"old_string\":\"func main() {\\n\\tfmt.Println(\\\"Hello, World!\\\")\\n}\"},\"name\":\"edit\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01QZMh8Q3YHr4KMqzYJx5MfX\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cresult\\u003e\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file/main.go\\n\\u003c/result\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"update the main.go file by changing the print to say hello from crush\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_014B6GpHgUPh5aunbj68jSZf\",\"input\":{\"file_path\":\"main.go\"},\"name\":\"view\",\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_014B6GpHgUPh5aunbj68jSZf\",\"content\":[{\"text\":\"\\u003cfile\\u003e\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\u003c/file\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01JLieGu2SvbZnaKsfaNiH8q\",\"input\":{\"file_path\":\"main.go\",\"new_string\":\"func main() {\\n\\tfmt.Println(\\\"hello from crush\\\")\\n}\",\"old_string\":\"func main() {\\n\\tfmt.Println(\\\"Hello, World!\\\")\\n}\"},\"name\":\"edit\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01JLieGu2SvbZnaKsfaNiH8q\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cresult\\u003e\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file/main.go\\n\\u003c/result\\u003e\\n\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -337,26 +268,26 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01Dxt5LRc7o8Q5QHVCb4iVzu","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":199,"cache_read_input_tokens":12543,"cache_creation":{"ephemeral_5m_input_tokens":199,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_016yLh8zkPiQM5mDP1fztq6T","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":5,"cache_creation_input_tokens":175,"cache_read_input_tokens":12180,"cache_creation":{"ephemeral_5m_input_tokens":175,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Done"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Done"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":199,"cache_read_input_tokens":12543,"output_tokens":4} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":5,"cache_creation_input_tokens":175,"cache_read_input_tokens":12180,"output_tokens":4} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop"} headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 3.56486375s + duration: 2.565383958s diff --git a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/write_tool.yaml b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/write_tool.yaml index b9f5736cb310f621b5bd09a0872872dd98ad3b3c..e17b46b008d1b6b4a5853d1606a11315a3c8a91a 100644 --- a/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/write_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/anthropic-sonnet/write_tool.yaml @@ -25,16 +25,16 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01FjvqkSUirvNJcG5AknVvWJ","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":161,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-3-5-haiku-20241022","id":"msg_01KbRrwrshHxFFpTr81tTbPZ","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":161,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Creating"}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Create"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" config"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" config"} } event: ping data: {"type": "ping"} @@ -43,34 +43,34 @@ interactions: data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":".json with"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" JSON"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" JSON"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" data"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" data"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":161,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":10}} + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":161,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":10} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 608.98875ms + duration: 545.678833ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45586 + content_length: 44261 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -87,94 +87,97 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01APYZCw3ndYJMz138jBUS5N","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3704,"cache_read_input_tokens":8698,"cache_creation":{"ephemeral_5m_input_tokens":3704,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01CWmu4ADWiubwkDgyk9u9gq","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":3704,"cache_read_input_tokens":8370,"cache_creation":{"ephemeral_5m_input_tokens":3704,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_014gGDBJLCzW97237FR5eqBH","name":"write","input":{}} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01P7Js2CcDuKeafdbCU1nDGE","name":"write","input":{}} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"file"}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"file_pat"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"_path\""} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"h\": \"/tmp"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \"/"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"/crus"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"tm"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"h-test/"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"p/cr"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"TestC"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ush-"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"oderA"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"test/TestCo"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"gent/a"}} event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"derAgent/ant"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"nthropic-so"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"hropic-son"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"nnet/wr"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"net/write_"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ite"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"to"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"_tool/co"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"ol/config.js"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"nfig.json\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"on\""}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"content\""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":", \"content"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":": \"{\\"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\": \"{\\\"name\\"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"name"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\": \\\"test"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\\\": \\\"test"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\\\", \\\"versi"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\\\", \\\"versio"} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"on\\\":"}} + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"n\\\": \\\"1."} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" \\\"1.0.0\\\"}\"}"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"0."} } + + event: content_block_delta + data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"0\\\"}\"}"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3704,"cache_read_input_tokens":8698,"output_tokens":109} } + data: {"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"input_tokens":2,"cache_creation_input_tokens":3704,"cache_read_input_tokens":8370,"output_tokens":109} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.970556916s + duration: 2.040430625s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 46155 + content_length: 44830 host: "" - body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_014gGDBJLCzW97237FR5eqBH\",\"input\":{\"content\":\"{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}\",\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/write_tool/config.json\"},\"name\":\"write\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_014gGDBJLCzW97237FR5eqBH\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cresult\\u003e\\nFile successfully written: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/write_tool/config.json\\n\\u003c/result\\u003e\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"},\"name\":\"fetch\",\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\u003cusage\\u003e\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" + body: "{\"max_tokens\":10000,\"messages\":[{\"content\":[{\"text\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"type\":\"text\"}],\"role\":\"user\"},{\"content\":[{\"id\":\"toolu_01P7Js2CcDuKeafdbCU1nDGE\",\"input\":{\"content\":\"{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}\",\"file_path\":\"/tmp/crush-test/TestCoderAgent/anthropic-sonnet/write_tool/config.json\"},\"name\":\"write\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"tool_use\"}],\"role\":\"assistant\"},{\"content\":[{\"tool_use_id\":\"toolu_01P7Js2CcDuKeafdbCU1nDGE\",\"cache_control\":{\"type\":\"ephemeral\"},\"content\":[{\"text\":\"\\u003cresult\\u003e\\nFile successfully written: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/write_tool/config.json\\n\\u003c/result\\u003e\",\"type\":\"text\"}],\"type\":\"tool_result\"}],\"role\":\"user\"}],\"model\":\"claude-sonnet-4-5-20250929\",\"system\":[{\"text\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\u003ccritical_rules\\u003e\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\u003c/critical_rules\\u003e\\n\\n\\u003ccommunication_style\\u003e\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\u003c/communication_style\\u003e\\n\\n\\u003ccode_references\\u003e\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\u003c/code_references\\u003e\\n\\n\\u003cworkflow\\u003e\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\u003c/workflow\\u003e\\n\\n\\u003cdecision_making\\u003e\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\u003c/decision_making\\u003e\\n\\n\\u003ctask_scope\\u003e\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\u003c/task_scope\\u003e\\n\\n\\u003cediting_files\\u003e\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\u003c/editing_files\\u003e\\n\\n\\u003cwhitespace_and_exact_matching\\u003e\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\u003c/whitespace_and_exact_matching\\u003e\\n\\n\\u003cerror_handling\\u003e\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\u003c/error_handling\\u003e\\n\\n\\u003cmemory_instructions\\u003e\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\u003c/memory_instructions\\u003e\\n\\n\\u003ccode_conventions\\u003e\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\u003c/code_conventions\\u003e\\n\\n\\u003ctesting\\u003e\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\u003c/testing\\u003e\\n\\n\\u003ctool_usage\\u003e\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\u003cbash_commands\\u003e\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `\\u0026` for background processes that won't stop on their own (e.g., `node server.js \\u0026`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status \\u0026\\u0026 git diff HEAD \\u0026\\u0026 git log -n 3`)\\n\\u003c/bash_commands\\u003e\\n\\u003c/tool_usage\\u003e\\n\\n\\u003cproactiveness\\u003e\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\u003c/proactiveness\\u003e\\n\\n\\u003cfinal_answers\\u003e\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\u003c/final_answers\\u003e\\n\\n\\u003cenv\\u003e\\nWorking directory: /tmp/crush-test/TestCoderAgent/anthropic-sonnet/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\u003c/env\\u003e\\n\\n\\n\\n\\n\",\"cache_control\":{\"type\":\"ephemeral\"},\"type\":\"text\"}],\"tool_choice\":{\"disable_parallel_tool_use\":false,\"type\":\"auto\"},\"tools\":[{\"input_schema\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"},\"name\":\"bash\",\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\u003ccross_platform\\u003e\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\u003c/cross_platform\\u003e\\n\\n\\u003cexecution_steps\\u003e\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with \\u003ccwd\\u003e\\u003c/cwd\\u003e tags\\n\\u003c/execution_steps\\u003e\\n\\n\\u003cusage_notes\\u003e\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '\\u0026\\u0026', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\u003c/usage_notes\\u003e\\n\\n\\u003cgit_commits\\u003e\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in \\u003ccommit_analysis\\u003e tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\u003ccrush@charm.land\\u003e\\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\u003c/git_commits\\u003e\\n\\n\\u003cpull_requests\\u003e\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in \\u003cpr_analysis\\u003e tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat \\u0026lt;\\u0026lt;'EOF'\\n\\n ## Summary\\n\\n \\u0026lt;1-3 bullet points\\u003e\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\u003c/pull_requests\\u003e\\n\\n\\u003cexamples\\u003e\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar \\u0026\\u0026 pytest tests\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"},\"name\":\"download\",\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\u003cusage\\u003e\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"},\"name\":\"edit\",\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\u003c/parameters\\u003e\\n\\n\\u003cspecial_cases\\u003e\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\u003c/special_cases\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\u003c/critical_requirements\\u003e\\n\\n\\u003cwarnings\\u003e\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) \\u003e 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\u003c/examples\\u003e\\n\\n\\u003cwindows_notes\\u003e\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\u003c/windows_notes\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"},\"name\":\"multiedit\",\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\u003cprerequisites\\u003e\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\u003c/prerequisites\\u003e\\n\\n\\u003cparameters\\u003e\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\u003c/parameters\\u003e\\n\\n\\u003coperation\\u003e\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\u003c/operation\\u003e\\n\\n\\u003cinherited_rules\\u003e\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\u003c/inherited_rules\\u003e\\n\\n\\u003ccritical_requirements\\u003e\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\u003c/critical_requirements\\u003e\\n\\n\\u003cverification_before_using\\u003e\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\u003c/verification_before_using\\u003e\\n\\n\\u003cwarnings\\u003e\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\u003c/warnings\\u003e\\n\\n\\u003crecovery_steps\\u003e\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\u003c/recovery_steps\\u003e\\n\\n\\u003cbest_practices\\u003e\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\u003c/best_practices\\u003e\\n\\n\\u003cwhitespace_checklist\\u003e\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\u003c/whitespace_checklist\\u003e\\n\\n\\u003cexamples\\u003e\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\u003c/examples\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"glob\",\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cpattern_syntax\\u003e\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\u003c/pattern_syntax\\u003e\\n\\n\\u003cexamples\\u003e\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\u003c/examples\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"},\"name\":\"grep\",\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\u003cusage\\u003e\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\u003c/usage\\u003e\\n\\n\\u003cregex_syntax\\u003e\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\u003c/regex_syntax\\u003e\\n\\n\\u003cinclude_patterns\\u003e\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\u003c/include_patterns\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\u003c/limitations\\u003e\\n\\n\\u003cignore_support\\u003e\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\u003c/ignore_support\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"},\"name\":\"ls\",\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\u003cusage\\u003e\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"},\"name\":\"sourcegraph\",\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\u003cusage\\u003e\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\u003c/usage\\u003e\\n\\n\\u003cbasic_syntax\\u003e\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\u003c/basic_syntax\\u003e\\n\\n\\u003ckey_filters\\u003e\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\u003c/key_filters\\u003e\\n\\n\\u003cexamples\\u003e\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\u003c/examples\\u003e\\n\\n\\u003cboolean_operators\\u003e\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\u003c/boolean_operators\\u003e\\n\\n\\u003climitations\\u003e\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\u003c/limitations\\u003e\\n\\n\\u003ctips\\u003e\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"},\"name\":\"view\",\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\u003cusage\\u003e\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines \\u003e2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\u003c/tips\\u003e\\n\"},{\"input_schema\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"},\"name\":\"write\",\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\u003cusage\\u003e\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\u003c/usage\\u003e\\n\\n\\u003cfeatures\\u003e\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\u003c/features\\u003e\\n\\n\\u003climitations\\u003e\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\u003c/limitations\\u003e\\n\\n\\u003ccross_platform\\u003e\\n- Use forward slashes (/) for compatibility\\n\\u003c/cross_platform\\u003e\\n\\n\\u003ctips\\u003e\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\u003c/tips\\u003e\\n\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"stream\":true}" headers: Accept: - application/json @@ -191,26 +194,26 @@ interactions: content_length: -1 body: |+ event: message_start - data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01W49rc7tLrQfhRNXAUd9TiR","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":4,"cache_creation_input_tokens":155,"cache_read_input_tokens":12402,"cache_creation":{"ephemeral_5m_input_tokens":155,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } + data: {"type":"message_start","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01Li3SpRFRZ5b6oFrAtgF654","type":"message","role":"assistant","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":4,"cache_creation_input_tokens":155,"cache_read_input_tokens":12074,"cache_creation":{"ephemeral_5m_input_tokens":155,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}} } event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Done"} } + data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Done"} } event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"type":"content_block_stop","index":0 } event: message_delta - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":4,"cache_creation_input_tokens":155,"cache_read_input_tokens":12402,"output_tokens":4} } + data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":4,"cache_creation_input_tokens":155,"cache_read_input_tokens":12074,"output_tokens":4} } event: message_stop - data: {"type":"message_stop" } + data: {"type":"message_stop" } headers: Content-Type: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 3.591235417s + duration: 2.139133792s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/bash_tool.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/bash_tool.yaml index 4d05418aa499c408326966dc7432158ee0ba0980..c3a99d0899d53b1d40298098d93a6a72802e3a0a 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/bash_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/bash_tool.yaml @@ -24,31 +24,23 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVkYXlQVkG4kOITZtPeGj1Wea2jlT","object":"chat.completion.chunk","created":1761683165,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"I5izUUiZXafojL"} + data: {"id":"chatcmpl-CVxgRENNgQBmQQNfhycMsmaIbNqWv","object":"chat.completion.chunk","created":1761733627,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"AmGM22zptWNTlH"} - data: {"id":"chatcmpl-CVkYXlQVkG4kOITZtPeGj1Wea2jlT","object":"chat.completion.chunk","created":1761683165,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"Create"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"zoT7el8iPw"} + data: {"id":"chatcmpl-CVxgRENNgQBmQQNfhycMsmaIbNqWv","object":"chat.completion.chunk","created":1761733627,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"Creating"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"eJBz1mtg"} - data: {"id":"chatcmpl-CVkYXlQVkG4kOITZtPeGj1Wea2jlT","object":"chat.completion.chunk","created":1761683165,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" test"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"8JjJrzhJf3i"} + data: {"id":"chatcmpl-CVxgRENNgQBmQQNfhycMsmaIbNqWv","object":"chat.completion.chunk","created":1761733627,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" a"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"H6sTw26kW8d7pO"} - data: {"id":"chatcmpl-CVkYXlQVkG4kOITZtPeGj1Wea2jlT","object":"chat.completion.chunk","created":1761683165,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":".txt"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"SNLsh5OJDZ0i"} + data: {"id":"chatcmpl-CVxgRENNgQBmQQNfhycMsmaIbNqWv","object":"chat.completion.chunk","created":1761733627,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Bash"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"G3qQHR9jtY0"} - data: {"id":"chatcmpl-CVkYXlQVkG4kOITZtPeGj1Wea2jlT","object":"chat.completion.chunk","created":1761683165,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" with"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"5ZU4WISnahF"} + data: {"id":"chatcmpl-CVxgRENNgQBmQQNfhycMsmaIbNqWv","object":"chat.completion.chunk","created":1761733627,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" File"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"zamRbLdg0dM"} - data: {"id":"chatcmpl-CVkYXlQVkG4kOITZtPeGj1Wea2jlT","object":"chat.completion.chunk","created":1761683165,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" '"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"lS5v20QIaaXehp"} + data: {"id":"chatcmpl-CVxgRENNgQBmQQNfhycMsmaIbNqWv","object":"chat.completion.chunk","created":1761733627,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Without"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"nqr5RpLY"} - data: {"id":"chatcmpl-CVkYXlQVkG4kOITZtPeGj1Wea2jlT","object":"chat.completion.chunk","created":1761683165,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"hello"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"N4Qd5ORSmwO"} + data: {"id":"chatcmpl-CVxgRENNgQBmQQNfhycMsmaIbNqWv","object":"chat.completion.chunk","created":1761733627,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Timestamp"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"QOCCZN"} - data: {"id":"chatcmpl-CVkYXlQVkG4kOITZtPeGj1Wea2jlT","object":"chat.completion.chunk","created":1761683165,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" bash"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"w7QB3j8cVFr"} + data: {"id":"chatcmpl-CVxgRENNgQBmQQNfhycMsmaIbNqWv","object":"chat.completion.chunk","created":1761733627,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"ZuZ2wup3vx"} - data: {"id":"chatcmpl-CVkYXlQVkG4kOITZtPeGj1Wea2jlT","object":"chat.completion.chunk","created":1761683165,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"'"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"yMufQpWW4809JSV"} - - data: {"id":"chatcmpl-CVkYXlQVkG4kOITZtPeGj1Wea2jlT","object":"chat.completion.chunk","created":1761683165,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"onq1SihfeIeJN"} - - data: {"id":"chatcmpl-CVkYXlQVkG4kOITZtPeGj1Wea2jlT","object":"chat.completion.chunk","created":1761683165,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Bash"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"0JcXLGDWmtE"} - - data: {"id":"chatcmpl-CVkYXlQVkG4kOITZtPeGj1Wea2jlT","object":"chat.completion.chunk","created":1761683165,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"ZQsiyh6q9P"} - - data: {"id":"chatcmpl-CVkYXlQVkG4kOITZtPeGj1Wea2jlT","object":"chat.completion.chunk","created":1761683165,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[],"usage":{"prompt_tokens":145,"completion_tokens":10,"total_tokens":155,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"0EehISoHXSeTj"} + data: {"id":"chatcmpl-CVxgRENNgQBmQQNfhycMsmaIbNqWv","object":"chat.completion.chunk","created":1761733627,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[],"usage":{"prompt_tokens":145,"completion_tokens":6,"total_tokens":151,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"z8SYkOuOZ7Truu"} data: [DONE] @@ -57,15 +49,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 841.764917ms + duration: 449.903375ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44015 + content_length: 42726 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'. do not print its timestamp\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'. do not print its timestamp\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -81,127 +73,69 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"CpD1TKkqdM"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Creating"},"finish_reason":null}],"usage":null,"obfuscation":"x3k3"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" test"},"finish_reason":null}],"usage":null,"obfuscation":"d0zoukO"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".txt"},"finish_reason":null}],"usage":null,"obfuscation":"uH4vQTTA"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" with"},"finish_reason":null}],"usage":null,"obfuscation":"HED1R4D"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" exact"},"finish_reason":null}],"usage":null,"obfuscation":"7ZXeN9"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" content"},"finish_reason":null}],"usage":null,"obfuscation":"TWLk"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" using"},"finish_reason":null}],"usage":null,"obfuscation":"s8ojwa"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" printf"},"finish_reason":null}],"usage":null,"obfuscation":"EBF7d"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" red"},"finish_reason":null}],"usage":null,"obfuscation":"i4VbbUrD"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"irection"},"finish_reason":null}],"usage":null,"obfuscation":"3hMr"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"finish_reason":null}],"usage":null,"obfuscation":"c4JqlWD2cIh"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":null,"tool_calls":[{"index":0,"id":"call_OTarE0FgKJhll42rG12IZXE3","type":"function","function":{"name":"bash","arguments":""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Bi7zGW5vVWNJDQ"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"0bTwUNfBhWaf1KM"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"command"}}]},"finish_reason":null}],"usage":null,"obfuscation":"CYYTDA88pV3"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"3dVp4uWmdaejU"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"printf"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4K6Smx1usAgf"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" '"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"44HfXbUUpe9iV"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" bash"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Mn7KkYVf4EPYx"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"'"}}]},"finish_reason":null}],"usage":null,"obfuscation":"I"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" >"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" /"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"upOUAgtYLvFByxr"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"RLV5jdxECU5P48A"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"wsUbI0yelXka1SB"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"IaoN4lf3SPWbj"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"b9O0FglMQyQvp"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xSlXEHnaux1py"} - - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yRNxCh8Qcycsk"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_TMbkB4wXmLSygqinfCgs11GM","type":"function","function":{"name":"bash","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"yRpfZf17HH63"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dsQA0yGKr7peS"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"0JLp4xHFwdOwDoG"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"command"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kgtE2fnRwJU"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"qw6gnBOhfTRvz"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"printf"}}]},"finish_reason":null}],"usage":null,"obfuscation":"SfrdPFeUZSzG"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Y"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" '"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"y"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"D8jM8iFWhSmPU"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/bash"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yQbcfU73cqqQq"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" bash"}}]},"finish_reason":null}],"usage":null,"obfuscation":"5tOXa8kiBPkie"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Ewl6HAiAvTcWc"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"'"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"SHLmPoExLkSC7"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" >"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".txt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"CMh56MMJdUpUFl"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vqcRL25QhZAQB"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"7ImdWA3hY7z0d"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".txt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"V8l3FKiNwtxFyo"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"description"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ub8VkxU"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"bBgwT98AkOcv7"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"ZPRiazNYn1YEY"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"description"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gyUf2gN"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Create"}}]},"finish_reason":null}],"usage":null,"obfuscation":"K73QMSX1uPL7"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"szrl5yi2Wc9bZ"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vjZxzfXnjm8Xr"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Create"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8ajNQEBYIVxV"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".txt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"rIl2J67l8rXuxD"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"RbWpi2jBtokQA"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" with"}}]},"finish_reason":null}],"usage":null,"obfuscation":"60UDdqNuM5OUu"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".txt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"AyH6jxAYA8Y6XN"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" exact"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8Rvs7UBAzpy8"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" with"}}]},"finish_reason":null}],"usage":null,"obfuscation":"AD6BQb5mPWVrr"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" content"}}]},"finish_reason":null}],"usage":null,"obfuscation":"fH2pKmhiwQ"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" exact"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Y0ixRWlkl2Sf"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" '"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" content"}}]},"finish_reason":null}],"usage":null,"obfuscation":"l5n1YTs6X8"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dePrnG7IorFhQ"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" '"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" bash"}}]},"finish_reason":null}],"usage":null,"obfuscation":"wJF22khURDI4p"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"sVObKa5X3PemH"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"'"}}]},"finish_reason":null}],"usage":null,"obfuscation":"x"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" bash"}}]},"finish_reason":null}],"usage":null,"obfuscation":"bnofRiAXZlpSY"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" ("}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"'"}}]},"finish_reason":null}],"usage":null,"obfuscation":"z"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"no"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" without"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vEGYgR7MKr"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" trailing"}}]},"finish_reason":null}],"usage":null,"obfuscation":"FkeiFgf1S"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" trailing"}}]},"finish_reason":null}],"usage":null,"obfuscation":"r7saEDEm8"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" newline"}}]},"finish_reason":null}],"usage":null,"obfuscation":"fTxbHVYGwN"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" newline"}}]},"finish_reason":null}],"usage":null,"obfuscation":"j9J32fCgxJ"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":")."}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"kC7G7czT5LbE1Ec"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"lNHr0PXGDiGh7dP"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6"} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkYX0VwBWzsGKsGTK5zyQi0Z7MXL","object":"chat.completion.chunk","created":1761683165,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9746,"completion_tokens":1042,"total_tokens":10788,"prompt_tokens_details":{"cached_tokens":8832,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":960,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"5UHcdzUytfHtops"} + data: {"id":"chatcmpl-CVxgRM1pnv4UEhEs4KSRhsFXTy39h","object":"chat.completion.chunk","created":1761733627,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9498,"completion_tokens":687,"total_tokens":10185,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":640,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"nMJ"} data: [DONE] @@ -210,15 +144,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 20.1520555s + duration: 15.796848458s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44503 + content_length: 43088 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'. do not print its timestamp\",\"role\":\"user\"},{\"content\":\"Creating test.txt with exact content using printf redirection.\",\"tool_calls\":[{\"id\":\"call_OTarE0FgKJhll42rG12IZXE3\",\"function\":{\"arguments\":\"{\\\"command\\\":\\\"printf 'hello bash' > /tmp/crush-test/TestCoderAgent/openai-gpt-5/bash_tool/test.txt\\\",\\\"description\\\":\\\"Create test.txt with exact content 'hello bash' (no trailing newline).\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"no output\",\"tool_call_id\":\"call_OTarE0FgKJhll42rG12IZXE3\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'. do not print its timestamp\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_TMbkB4wXmLSygqinfCgs11GM\",\"function\":{\"arguments\":\"{\\\"command\\\":\\\"printf 'hello bash' > test.txt\\\",\\\"description\\\":\\\"Create test.txt with exact content 'hello bash' without trailing newline.\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"no output\",\"tool_call_id\":\"call_TMbkB4wXmLSygqinfCgs11GM\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -234,13 +168,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVkYsIEc2FjW44VeoxobvJ5QuGSmb","object":"chat.completion.chunk","created":1761683186,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"X8qCMkdRWp"} + data: {"id":"chatcmpl-CVxghp01yFFMIlKNfVDfWrqsHOzU0","object":"chat.completion.chunk","created":1761733643,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"wHK50rWEdk"} - data: {"id":"chatcmpl-CVkYsIEc2FjW44VeoxobvJ5QuGSmb","object":"chat.completion.chunk","created":1761683186,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Done"},"finish_reason":null}],"usage":null,"obfuscation":"uEfGWyNv"} + data: {"id":"chatcmpl-CVxghp01yFFMIlKNfVDfWrqsHOzU0","object":"chat.completion.chunk","created":1761733643,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Done"},"finish_reason":null}],"usage":null,"obfuscation":"PDNyrreg"} - data: {"id":"chatcmpl-CVkYsIEc2FjW44VeoxobvJ5QuGSmb","object":"chat.completion.chunk","created":1761683186,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"DbmiGT"} + data: {"id":"chatcmpl-CVxghp01yFFMIlKNfVDfWrqsHOzU0","object":"chat.completion.chunk","created":1761733643,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"aqDAzN"} - data: {"id":"chatcmpl-CVkYsIEc2FjW44VeoxobvJ5QuGSmb","object":"chat.completion.chunk","created":1761683186,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9834,"completion_tokens":4,"total_tokens":9838,"prompt_tokens_details":{"cached_tokens":8832,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"crS2K"} + data: {"id":"chatcmpl-CVxghp01yFFMIlKNfVDfWrqsHOzU0","object":"chat.completion.chunk","created":1761733643,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9551,"completion_tokens":4,"total_tokens":9555,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"9veof"} data: [DONE] @@ -249,4 +183,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.110866167s + duration: 2.070541833s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/download_tool.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/download_tool.yaml index 414c9bf4c5483550801f10c4934e56c067104057..f217f49ce933e8db10d6e13bee4f2e492a4e56da 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/download_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/download_tool.yaml @@ -24,23 +24,23 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVkqq6Trj6gZrpXcPNZi55d6OT7xT","object":"chat.completion.chunk","created":1761684300,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"3Q0CfgaOjtrce9"} + data: {"id":"chatcmpl-CVxgj94OGH0PU12dYpX5ciOExwngN","object":"chat.completion.chunk","created":1761733645,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"qnoXCpERe0gWXn"} - data: {"id":"chatcmpl-CVkqq6Trj6gZrpXcPNZi55d6OT7xT","object":"chat.completion.chunk","created":1761684300,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"Download"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"FvUGUmDN"} + data: {"id":"chatcmpl-CVxgj94OGH0PU12dYpX5ciOExwngN","object":"chat.completion.chunk","created":1761733645,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"Download"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"MdOIpJwO"} - data: {"id":"chatcmpl-CVkqq6Trj6gZrpXcPNZi55d6OT7xT","object":"chat.completion.chunk","created":1761684300,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" and"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"WdIFm5cczZBF"} + data: {"id":"chatcmpl-CVxgj94OGH0PU12dYpX5ciOExwngN","object":"chat.completion.chunk","created":1761733645,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" and"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"XTiP3mzn4l4j"} - data: {"id":"chatcmpl-CVkqq6Trj6gZrpXcPNZi55d6OT7xT","object":"chat.completion.chunk","created":1761684300,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Save"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"o6fkjFBDj0g"} + data: {"id":"chatcmpl-CVxgj94OGH0PU12dYpX5ciOExwngN","object":"chat.completion.chunk","created":1761733645,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Save"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ChohoJ0xvEb"} - data: {"id":"chatcmpl-CVkqq6Trj6gZrpXcPNZi55d6OT7xT","object":"chat.completion.chunk","created":1761684300,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" File"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"snoBJt70Nkp"} + data: {"id":"chatcmpl-CVxgj94OGH0PU12dYpX5ciOExwngN","object":"chat.completion.chunk","created":1761733645,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Example"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"yZdr5cxa"} - data: {"id":"chatcmpl-CVkqq6Trj6gZrpXcPNZi55d6OT7xT","object":"chat.completion.chunk","created":1761684300,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" from"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"stkjjr67Pqb"} + data: {"id":"chatcmpl-CVxgj94OGH0PU12dYpX5ciOExwngN","object":"chat.completion.chunk","created":1761733645,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Text"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"wLXF2szft7L"} - data: {"id":"chatcmpl-CVkqq6Trj6gZrpXcPNZi55d6OT7xT","object":"chat.completion.chunk","created":1761684300,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" URL"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"bxktqBZKgN4Q"} + data: {"id":"chatcmpl-CVxgj94OGH0PU12dYpX5ciOExwngN","object":"chat.completion.chunk","created":1761733645,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" File"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"edE8Pj15ERd"} - data: {"id":"chatcmpl-CVkqq6Trj6gZrpXcPNZi55d6OT7xT","object":"chat.completion.chunk","created":1761684300,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"Vkf5XiiVEb"} + data: {"id":"chatcmpl-CVxgj94OGH0PU12dYpX5ciOExwngN","object":"chat.completion.chunk","created":1761733645,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"vDjHdNR7An"} - data: {"id":"chatcmpl-CVkqq6Trj6gZrpXcPNZi55d6OT7xT","object":"chat.completion.chunk","created":1761684300,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[],"usage":{"prompt_tokens":148,"completion_tokens":6,"total_tokens":154,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"eVXGNbhTWZQR2C"} + data: {"id":"chatcmpl-CVxgj94OGH0PU12dYpX5ciOExwngN","object":"chat.completion.chunk","created":1761733645,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[],"usage":{"prompt_tokens":148,"completion_tokens":6,"total_tokens":154,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"ZjaRuMqxN1FALY"} data: [DONE] @@ -49,15 +49,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.138533041s + duration: 570.639625ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44040 + content_length: 42751 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -73,97 +73,65 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_ruLhdEuTMzt8Dd9dqm4UwRPV","type":"function","function":{"name":"download","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"BdiF8vyP"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_9Ysdb5sMRytjrwkVPE7QuaHI","type":"function","function":{"name":"download","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"XwXG70Ns"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"GM76cEP7584FFlz"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"8TRYhi8Hdqs5Ld0"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"url"}}]},"finish_reason":null}],"usage":null,"obfuscation":"rI19Znn6MoJD91H"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"url"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7CZoV7x6xHHEFNp"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"kOgnSqOt1sDLV"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"ONc0Iv47atrya"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"https"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9sRuM0NfGdvqY"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"https"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kdX17jZUHJNz4"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"://"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vLqWSbDas8X80tq"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"://"}}]},"finish_reason":null}],"usage":null,"obfuscation":"pclxJouIReBgT8Y"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"example"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ORR3XShIWJ3"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"example"}}]},"finish_reason":null}],"usage":null,"obfuscation":"UxqB4UeU3OG"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-files"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PupMYD6NSFD5"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-files"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gBkxsIR6JUoq"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".online"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2OimsA7mgHr"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".online"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4yClO8jUUM6"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-con"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Kwse0BOxR3tyHu"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-con"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0nJllYZKgpqaTD"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"vert"}}]},"finish_reason":null}],"usage":null,"obfuscation":"EDvAghukzStMTW"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"vert"}}]},"finish_reason":null}],"usage":null,"obfuscation":"aPdDcZYSWNLgsU"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".com"}}]},"finish_reason":null}],"usage":null,"obfuscation":"bIt1KKekla3Vul"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".com"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vALd1Apvsl0yZ8"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/document"}}]},"finish_reason":null}],"usage":null,"obfuscation":"zjuisJ5Ex"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/document"}}]},"finish_reason":null}],"usage":null,"obfuscation":"RHCmfryNO"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/t"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/t"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"xt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"xt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/example"}}]},"finish_reason":null}],"usage":null,"obfuscation":"lDpPbB6kqV"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/example"}}]},"finish_reason":null}],"usage":null,"obfuscation":"SFJWDjQ4xg"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".txt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PJVt8ZNPnytCu5"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".txt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"sgEAPvI6CO9S9m"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"jyTGCVcGnnfTW"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Oh1FKRIW8SB81"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"5tEujIhoSSyTH7"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7G5481vEbtVKoo"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"o44RbnSlzhK5N"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kbym2JuQakPNp"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"G4iqc55oQxSoVkT"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"xWOybUMYDlpZu"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7Aq2gdk13i0wbnp"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"example"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PS5lEK1J3o0"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8M5BKux7c5bL8kQ"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".txt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vQ3xJHlCF5a1E0"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"JRM9r8CbwZeSy4f"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"RFOsS8KiSuep8"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Z7K9l9AdcEQZ7yp"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"timeout"}}]},"finish_reason":null}],"usage":null,"obfuscation":"jmEXFPUt1Hc"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"K98Chh2enPEXp"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Z0VaTTNYZ4H23Dl"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Sp2UpbUs8Fa0T"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"120"}}]},"finish_reason":null}],"usage":null,"obfuscation":"wMhjNZDHyce229w"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0ZbrbEsSTR94L"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"h"} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"OkphQRG1mhUur"} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"t08SxqlZk5iXM"} - - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"k"} - - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"k"} - - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/download"}}]},"finish_reason":null}],"usage":null,"obfuscation":"lt7205TMK"} - - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9twUtQuecvOKI"} - - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/example"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2W2rFmTJIM"} - - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".txt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Fai70laDoyGhLH"} - - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"eyRSnBumlQlOe"} - - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"timeout"}}]},"finish_reason":null}],"usage":null,"obfuscation":"P02xWWDfALw"} - - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6M5Gwdsvdh1XKNq"} - - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"120"}}]},"finish_reason":null}],"usage":null,"obfuscation":"RJNT8YB2ZEquG5o"} - - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"p"} - - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CVkqqE7MW6Ux7o0WUeeuSch2kxFja","object":"chat.completion.chunk","created":1761684300,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9749,"completion_tokens":444,"total_tokens":10193,"prompt_tokens_details":{"cached_tokens":8832,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":384,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":""} + data: {"id":"chatcmpl-CVxgj5GaPJWoYIdRUOwQgLEjaCDnb","object":"chat.completion.chunk","created":1761733645,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9501,"completion_tokens":364,"total_tokens":9865,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":320,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"o"} data: [DONE] @@ -172,7 +140,7 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 11.797684417s + duration: 15.189889834s - id: 2 request: proto: HTTP/1.1 @@ -218,15 +186,15 @@ interactions: - text/plain; charset=UTF-8 status: 200 OK code: 200 - duration: 795.363917ms + duration: 176.149917ms - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44529 + content_length: 43182 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_ruLhdEuTMzt8Dd9dqm4UwRPV\",\"function\":{\"arguments\":\"{\\\"url\\\":\\\"https://example-files.online-convert.com/document/txt/example.txt\\\",\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/download_tool/example.txt\\\",\\\"timeout\\\":120}\",\"name\":\"download\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Successfully downloaded 2574 bytes to example.txt (Content-Type: text/plain; charset=UTF-8)\",\"tool_call_id\":\"call_ruLhdEuTMzt8Dd9dqm4UwRPV\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_9Ysdb5sMRytjrwkVPE7QuaHI\",\"function\":{\"arguments\":\"{\\\"url\\\":\\\"https://example-files.online-convert.com/document/txt/example.txt\\\",\\\"file_path\\\":\\\"example.txt\\\",\\\"timeout\\\":120}\",\"name\":\"download\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Successfully downloaded 2574 bytes to example.txt (Content-Type: text/plain; charset=UTF-8)\",\"tool_call_id\":\"call_9Ysdb5sMRytjrwkVPE7QuaHI\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -242,13 +210,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVkr31BSOwdlXBvYy0ANpIkIe6NoF","object":"chat.completion.chunk","created":1761684313,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"BQGPkSFJai"} + data: {"id":"chatcmpl-CVxgywF3DSs5qRp0iR4qBDfNQf1gK","object":"chat.completion.chunk","created":1761733660,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"r4N4E5uxdA"} - data: {"id":"chatcmpl-CVkr31BSOwdlXBvYy0ANpIkIe6NoF","object":"chat.completion.chunk","created":1761684313,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Done"},"finish_reason":null}],"usage":null,"obfuscation":"OSmYtb5r"} + data: {"id":"chatcmpl-CVxgywF3DSs5qRp0iR4qBDfNQf1gK","object":"chat.completion.chunk","created":1761733660,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Done"},"finish_reason":null}],"usage":null,"obfuscation":"B08A2nZ9"} - data: {"id":"chatcmpl-CVkr31BSOwdlXBvYy0ANpIkIe6NoF","object":"chat.completion.chunk","created":1761684313,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"uMWipy"} + data: {"id":"chatcmpl-CVxgywF3DSs5qRp0iR4qBDfNQf1gK","object":"chat.completion.chunk","created":1761733660,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"sczLcT"} - data: {"id":"chatcmpl-CVkr31BSOwdlXBvYy0ANpIkIe6NoF","object":"chat.completion.chunk","created":1761684313,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9834,"completion_tokens":4,"total_tokens":9838,"prompt_tokens_details":{"cached_tokens":8832,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"6D0hN"} + data: {"id":"chatcmpl-CVxgywF3DSs5qRp0iR4qBDfNQf1gK","object":"chat.completion.chunk","created":1761733660,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9570,"completion_tokens":4,"total_tokens":9574,"prompt_tokens_details":{"cached_tokens":8832,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"nw958"} data: [DONE] @@ -257,4 +225,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.482533292s + duration: 1.218773417s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/fetch_tool.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/fetch_tool.yaml deleted file mode 100644 index ef7772b82846e11252f4dd674dc41eef7f3c9d1e..0000000000000000000000000000000000000000 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/fetch_tool.yaml +++ /dev/null @@ -1,255 +0,0 @@ ---- -version: 2 -interactions: -- id: 0 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 794 - host: "" - body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nfetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word ''John Doe''\n \n\n","role":"user"}],"model":"gpt-4o","max_tokens":40,"stream_options":{"include_usage":true},"stream":true}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://api.openai.com/v1/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"chatcmpl-CVk4FFPkAR6LMqwDsO1tikJRErbbb","object":"chat.completion.chunk","created":1761681287,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"zuiedJFZgQpBA2"} - - data: {"id":"chatcmpl-CVk4FFPkAR6LMqwDsO1tikJRErbbb","object":"chat.completion.chunk","created":1761681287,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"Check"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"LktXXhIuz6U"} - - data: {"id":"chatcmpl-CVk4FFPkAR6LMqwDsO1tikJRErbbb","object":"chat.completion.chunk","created":1761681287,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" for"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"8sQhOVLXweHQ"} - - data: {"id":"chatcmpl-CVk4FFPkAR6LMqwDsO1tikJRErbbb","object":"chat.completion.chunk","created":1761681287,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" '"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"zKD9ot2I8chtC0"} - - data: {"id":"chatcmpl-CVk4FFPkAR6LMqwDsO1tikJRErbbb","object":"chat.completion.chunk","created":1761681287,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"John"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"o2fM1DnimM9h"} - - data: {"id":"chatcmpl-CVk4FFPkAR6LMqwDsO1tikJRErbbb","object":"chat.completion.chunk","created":1761681287,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Doe"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"XyiiDtu8rgPT"} - - data: {"id":"chatcmpl-CVk4FFPkAR6LMqwDsO1tikJRErbbb","object":"chat.completion.chunk","created":1761681287,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":"'"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"8XwWkP5nxbYZiaM"} - - data: {"id":"chatcmpl-CVk4FFPkAR6LMqwDsO1tikJRErbbb","object":"chat.completion.chunk","created":1761681287,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"q8bhDDYdcIBTG"} - - data: {"id":"chatcmpl-CVk4FFPkAR6LMqwDsO1tikJRErbbb","object":"chat.completion.chunk","created":1761681287,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" HTML"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"bND7TZ3EDcw"} - - data: {"id":"chatcmpl-CVk4FFPkAR6LMqwDsO1tikJRErbbb","object":"chat.completion.chunk","created":1761681287,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{"content":" Content"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"OcKqmbdJ"} - - data: {"id":"chatcmpl-CVk4FFPkAR6LMqwDsO1tikJRErbbb","object":"chat.completion.chunk","created":1761681287,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"A9oI3T2IDh"} - - data: {"id":"chatcmpl-CVk4FFPkAR6LMqwDsO1tikJRErbbb","object":"chat.completion.chunk","created":1761681287,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_a788c5aef0","choices":[],"usage":{"prompt_tokens":153,"completion_tokens":9,"total_tokens":162,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"nyxpQFx8svYAu6"} - - data: [DONE] - - headers: - Content-Type: - - text/event-stream; charset=utf-8 - status: 200 OK - code: 200 - duration: 845.24925ms -- id: 1 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 44058 - host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"fetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word 'John Doe'\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://api.openai.com/v1/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_8VNS1tdrBoE2z0rOMuRarmf2","type":"function","function":{"name":"fetch","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"qbMTsYdpv6T"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"LPtlkVX9BVuhO1w"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"url"}}]},"finish_reason":null}],"usage":null,"obfuscation":"rWDfPCiK4gGslVy"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"PzjQqD2Wgdjph"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"https"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Gxl6n9hkBtdy1"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"://"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kYusPH2kpDp6RXw"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"example"}}]},"finish_reason":null}],"usage":null,"obfuscation":"XmfI2thPtdG"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-files"}}]},"finish_reason":null}],"usage":null,"obfuscation":"lvuuU5H2m6vq"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".online"}}]},"finish_reason":null}],"usage":null,"obfuscation":"cG37FO9inVm"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-con"}}]},"finish_reason":null}],"usage":null,"obfuscation":"BemDVaWRmQDX8h"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"vert"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qUjzM9TeYKKnsp"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".com"}}]},"finish_reason":null}],"usage":null,"obfuscation":"E3ZlNDebxE4pMg"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"website"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1KzUbouqWLb"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/html"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TdBhLrmXOFJKq"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/example"}}]},"finish_reason":null}],"usage":null,"obfuscation":"EVdKEh2hXI"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".html"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9B0Z1JegLVfgf"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"4Vi6QTELcKR3t"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"format"}}]},"finish_reason":null}],"usage":null,"obfuscation":"anOEBLUoSR8W"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Y3UPpEh7O6On1"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"text"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xxcZrVpP7yaoKg"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"tynlX5SqNEfa2"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"timeout"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1nnM9QlYIfO"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"WcQGaFRZggIt9WP"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"60"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"b"} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CVk4FkOwUXwjzNm7qECczn32gckCx","object":"chat.completion.chunk","created":1761681287,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9756,"completion_tokens":426,"total_tokens":10182,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":384,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":""} - - data: [DONE] - - headers: - Content-Type: - - text/event-stream; charset=utf-8 - status: 200 OK - code: 200 - duration: 9.902295417s -- id: 2 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 0 - host: example-files.online-convert.com - headers: - User-Agent: - - crush/1.0 - url: https://example-files.online-convert.com/website/html/example.html - method: GET - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - uncompressed: true - body: |- - - - - - -

HTML test file

- -

Purpose: Provide example of this file type
- Document file type: HTML
- Version: 1.0
- Remark:

- -

- - Example content:
- The names "John Doe" for males, "Jane Doe" or "Jane Roe" for females, or "Jonnie Doe" and "Janie Doe" for children, or just "Doe" non-gender-specifically are used as placeholder names for a party whose true identity is unknown or must be withheld in a legal action, case, or discussion. The names are also used to refer to acorpse or hospital patient whose identity is unknown. This practice is widely used in the United States and Canada, but is rarely used in other English-speaking countries including the United Kingdom itself, from where the use of "John Doe" in a legal context originates. The names Joe Bloggs or John Smith are used in the UK instead, as well as in Australia and New Zealand.

- -

John Doe is sometimes used to refer to a typical male in other contexts as well, in a similar manner to John Q. Public, known in Great Britain as Joe Public, John Smith or Joe Bloggs. For example, the first name listed on a form is often John Doe, along with a fictional address or other fictional information to provide an example of how to fill in the form. The name is also used frequently in popular culture, for example in the Frank Capra film Meet John Doe. John Doe was also the name of a 2002 American television series.

- -

Similarly, a child or baby whose identity is unknown may be referred to as Baby Doe. A notorious murder case in Kansas City, Missouri, referred to the baby victim as Precious Doe. Other unidentified female murder victims are Cali Doe and Princess Doe. Additional persons may be called James Doe, Judy Doe, etc. However, to avoid possible confusion, if two anonymous or unknown parties are cited in a specific case or action, the surnames Doe and Roe may be used simultaneously; for example, "John Doe v. Jane Roe". If several anonymous parties are referenced, they may simply be labelled John Doe #1, John Doe #2, etc. (the U.S. Operation Delego cited 21 (numbered) "John Doe"s) or labelled with other variants of Doe / Roe / Poe / etc. Other early alternatives such as John Stiles and Richard Miles are now rarely used, and Mary Major has been used in some American federal cases.

- -

- - File created by https://www.online-convert.com
- More example files: https://www.online-convert.com/file-type
- Text of "Example content": Wikipedia
- License: Attribution-ShareAlike 3.0 Unported - -

- -

Feel free to use and share the file according to license above.

- - - - headers: - Content-Type: - - text/html; charset=UTF-8 - status: 200 OK - code: 200 - duration: 294.733791ms -- id: 3 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 46890 - host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"fetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word 'John Doe'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_8VNS1tdrBoE2z0rOMuRarmf2\",\"function\":{\"arguments\":\"{\\\"url\\\":\\\"https://example-files.online-convert.com/website/html/example.html\\\",\\\"format\\\":\\\"text\\\",\\\"timeout\\\":60}\",\"name\":\"fetch\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"HTML test file Purpose: Provide example of this file type Document file type: HTML Version: 1.0 Remark: Example content: The names \\\"John Doe\\\" for males, \\\"Jane Doe\\\" or \\\"Jane Roe\\\" for females, or \\\"Jonnie Doe\\\" and \\\"Janie Doe\\\" for children, or just \\\"Doe\\\" non-gender-specifically are used as placeholder names for a party whose true identity is unknown or must be withheld in a legal action, case, or discussion. The names are also used to refer to acorpse or hospital patient whose identity is unknown. This practice is widely used in the United States and Canada, but is rarely used in other English-speaking countries including the United Kingdom itself, from where the use of \\\"John Doe\\\" in a legal context originates. The names Joe Bloggs or John Smith are used in the UK instead, as well as in Australia and New Zealand. John Doe is sometimes used to refer to a typical male in other contexts as well, in a similar manner to John Q. Public, known in Great Britain as Joe Public, John Smith or Joe Bloggs. For example, the first name listed on a form is often John Doe, along with a fictional address or other fictional information to provide an example of how to fill in the form. The name is also used frequently in popular culture, for example in the Frank Capra film Meet John Doe. John Doe was also the name of a 2002 American television series. Similarly, a child or baby whose identity is unknown may be referred to as Baby Doe. A notorious murder case in Kansas City, Missouri, referred to the baby victim as Precious Doe. Other unidentified female murder victims are Cali Doe and Princess Doe. Additional persons may be called James Doe, Judy Doe, etc. However, to avoid possible confusion, if two anonymous or unknown parties are cited in a specific case or action, the surnames Doe and Roe may be used simultaneously; for example, \\\"John Doe v. Jane Roe\\\". If several anonymous parties are referenced, they may simply be labelled John Doe #1, John Doe #2, etc. (the U.S. Operation Delego cited 21 (numbered) \\\"John Doe\\\"s) or labelled with other variants of Doe / Roe / Poe / etc. Other early alternatives such as John Stiles and Richard Miles are now rarely used, and Mary Major has been used in some American federal cases. File created by https://www.online-convert.com More example files: https://www.online-convert.com/file-type Text of \\\"Example content\\\": Wikipedia License: Attribution-ShareAlike 3.0 Unported Feel free to use and share the file according to license above.\",\"tool_call_id\":\"call_8VNS1tdrBoE2z0rOMuRarmf2\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://api.openai.com/v1/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"chatcmpl-CVk4QXwJHqnZnnNzBX3w60YpyHCeV","object":"chat.completion.chunk","created":1761681298,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"uK1IsOTu2P"} - - data: {"id":"chatcmpl-CVk4QXwJHqnZnnNzBX3w60YpyHCeV","object":"chat.completion.chunk","created":1761681298,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Yes"},"finish_reason":null}],"usage":null,"obfuscation":"h4iNjZvNa"} - - data: {"id":"chatcmpl-CVk4QXwJHqnZnnNzBX3w60YpyHCeV","object":"chat.completion.chunk","created":1761681298,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"CtXXkU"} - - data: {"id":"chatcmpl-CVk4QXwJHqnZnnNzBX3w60YpyHCeV","object":"chat.completion.chunk","created":1761681298,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":10350,"completion_tokens":138,"total_tokens":10488,"prompt_tokens_details":{"cached_tokens":8832,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":128,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"4dK8cSaEU3kKcyj"} - - data: [DONE] - - headers: - Content-Type: - - text/event-stream; charset=utf-8 - status: 200 OK - code: 200 - duration: 6.913767334s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/glob_tool.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/glob_tool.yaml index 49f4f8d5bf28249c4d6af2c5022d54cbfd4e18c5..b287c5e9a682ca53af31fd43294e95962a9a570b 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/glob_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/glob_tool.yaml @@ -24,31 +24,29 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk4XBWaJ5qgdSns8unlydp75Uizi","object":"chat.completion.chunk","created":1761681305,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"DBgYnSzS2A0y6Y"} + data: {"id":"chatcmpl-CVxh0NmURYxVtqlY01HjgtD7EAp5f","object":"chat.completion.chunk","created":1761733662,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"NAB1DQHw2gqDTq"} - data: {"id":"chatcmpl-CVk4XBWaJ5qgdSns8unlydp75Uizi","object":"chat.completion.chunk","created":1761681305,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"Finding"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"elxl9svnK"} + data: {"id":"chatcmpl-CVxh0NmURYxVtqlY01HjgtD7EAp5f","object":"chat.completion.chunk","created":1761733662,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"Find"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"tjkFQVwAavwV"} - data: {"id":"chatcmpl-CVk4XBWaJ5qgdSns8unlydp75Uizi","object":"chat.completion.chunk","created":1761681305,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" All"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"DtWJu9bvJcpU"} + data: {"id":"chatcmpl-CVxh0NmURYxVtqlY01HjgtD7EAp5f","object":"chat.completion.chunk","created":1761733662,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" ."},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"FVzYKWkCdRyjz3"} - data: {"id":"chatcmpl-CVk4XBWaJ5qgdSns8unlydp75Uizi","object":"chat.completion.chunk","created":1761681305,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" ."},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"vHO9MB9bxBWmyF"} + data: {"id":"chatcmpl-CVxh0NmURYxVtqlY01HjgtD7EAp5f","object":"chat.completion.chunk","created":1761733662,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"YjIhAj6gucsNHH"} - data: {"id":"chatcmpl-CVk4XBWaJ5qgdSns8unlydp75Uizi","object":"chat.completion.chunk","created":1761681305,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"gyCDou7GXmJbPW"} + data: {"id":"chatcmpl-CVxh0NmURYxVtqlY01HjgtD7EAp5f","object":"chat.completion.chunk","created":1761733662,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Files"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"G9fkKXijRw"} - data: {"id":"chatcmpl-CVk4XBWaJ5qgdSns8unlydp75Uizi","object":"chat.completion.chunk","created":1761681305,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Files"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"9TsD1Q9alm"} + data: {"id":"chatcmpl-CVxh0NmURYxVtqlY01HjgtD7EAp5f","object":"chat.completion.chunk","created":1761733662,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"hWmnIdbdX1KP9"} - data: {"id":"chatcmpl-CVk4XBWaJ5qgdSns8unlydp75Uizi","object":"chat.completion.chunk","created":1761681305,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" with"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"CTaSum4Hl0D"} + data: {"id":"chatcmpl-CVxh0NmURYxVtqlY01HjgtD7EAp5f","object":"chat.completion.chunk","created":1761733662,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Current"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"4WiZFnlU"} - data: {"id":"chatcmpl-CVk4XBWaJ5qgdSns8unlydp75Uizi","object":"chat.completion.chunk","created":1761681305,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Glob"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"J7Ytqr8JeSs"} + data: {"id":"chatcmpl-CVxh0NmURYxVtqlY01HjgtD7EAp5f","object":"chat.completion.chunk","created":1761733662,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Directory"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"3uDuH1"} - data: {"id":"chatcmpl-CVk4XBWaJ5qgdSns8unlydp75Uizi","object":"chat.completion.chunk","created":1761681305,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"GWb2EsZhtLx4d"} + data: {"id":"chatcmpl-CVxh0NmURYxVtqlY01HjgtD7EAp5f","object":"chat.completion.chunk","created":1761733662,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Using"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"3hS904uQpe"} - data: {"id":"chatcmpl-CVk4XBWaJ5qgdSns8unlydp75Uizi","object":"chat.completion.chunk","created":1761681305,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Current"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"zbdolta9"} + data: {"id":"chatcmpl-CVxh0NmURYxVtqlY01HjgtD7EAp5f","object":"chat.completion.chunk","created":1761733662,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Glob"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"EeipjNsefLb"} - data: {"id":"chatcmpl-CVk4XBWaJ5qgdSns8unlydp75Uizi","object":"chat.completion.chunk","created":1761681305,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Directory"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"LWYOdH"} + data: {"id":"chatcmpl-CVxh0NmURYxVtqlY01HjgtD7EAp5f","object":"chat.completion.chunk","created":1761733662,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"gVwsaEHMSj"} - data: {"id":"chatcmpl-CVk4XBWaJ5qgdSns8unlydp75Uizi","object":"chat.completion.chunk","created":1761681305,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"2joAULceCV"} - - data: {"id":"chatcmpl-CVk4XBWaJ5qgdSns8unlydp75Uizi","object":"chat.completion.chunk","created":1761681305,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[],"usage":{"prompt_tokens":137,"completion_tokens":10,"total_tokens":147,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"GS0MXVTjYqFty"} + data: {"id":"chatcmpl-CVxh0NmURYxVtqlY01HjgtD7EAp5f","object":"chat.completion.chunk","created":1761733662,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[],"usage":{"prompt_tokens":137,"completion_tokens":9,"total_tokens":146,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"KGvdqBbjH3kQl7"} data: [DONE] @@ -57,15 +55,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.181283541s + duration: 513.478542ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 43976 + content_length: 42687 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -81,23 +79,23 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk4XpSRbFhlAMW9vDZ3GOnDIFopq","object":"chat.completion.chunk","created":1761681305,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_KX6VQbRygcdVM5MH7i2zQ27o","type":"function","function":{"name":"glob","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"9Ec45GeIh3rC"} + data: {"id":"chatcmpl-CVxh09V8tSPjsVy251YpcNn5aEOnq","object":"chat.completion.chunk","created":1761733662,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_djbq3UQi92k8wpVk9DCI80dh","type":"function","function":{"name":"glob","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"p6nOM5WYhDLr"} - data: {"id":"chatcmpl-CVk4XpSRbFhlAMW9vDZ3GOnDIFopq","object":"chat.completion.chunk","created":1761681305,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"dNrAsg2puWfgUTg"} + data: {"id":"chatcmpl-CVxh09V8tSPjsVy251YpcNn5aEOnq","object":"chat.completion.chunk","created":1761733662,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Qet6BrVdGH6klkT"} - data: {"id":"chatcmpl-CVk4XpSRbFhlAMW9vDZ3GOnDIFopq","object":"chat.completion.chunk","created":1761681305,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pattern"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vx9thLBEWGV"} + data: {"id":"chatcmpl-CVxh09V8tSPjsVy251YpcNn5aEOnq","object":"chat.completion.chunk","created":1761733662,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pattern"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PbYGdrwDvoV"} - data: {"id":"chatcmpl-CVk4XpSRbFhlAMW9vDZ3GOnDIFopq","object":"chat.completion.chunk","created":1761681305,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"uCAgoYeITIwLQ"} + data: {"id":"chatcmpl-CVxh09V8tSPjsVy251YpcNn5aEOnq","object":"chat.completion.chunk","created":1761733662,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"HHf7caS87kS2l"} - data: {"id":"chatcmpl-CVk4XpSRbFhlAMW9vDZ3GOnDIFopq","object":"chat.completion.chunk","created":1761681305,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"*."}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxh09V8tSPjsVy251YpcNn5aEOnq","object":"chat.completion.chunk","created":1761733662,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"*."}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk4XpSRbFhlAMW9vDZ3GOnDIFopq","object":"chat.completion.chunk","created":1761681305,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxh09V8tSPjsVy251YpcNn5aEOnq","object":"chat.completion.chunk","created":1761733662,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk4XpSRbFhlAMW9vDZ3GOnDIFopq","object":"chat.completion.chunk","created":1761681305,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1xSFdNFJ6hMXLbd"} + data: {"id":"chatcmpl-CVxh09V8tSPjsVy251YpcNn5aEOnq","object":"chat.completion.chunk","created":1761733662,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"WV4cyjJKsZsIC0o"} - data: {"id":"chatcmpl-CVk4XpSRbFhlAMW9vDZ3GOnDIFopq","object":"chat.completion.chunk","created":1761681305,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxh09V8tSPjsVy251YpcNn5aEOnq","object":"chat.completion.chunk","created":1761733662,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk4XpSRbFhlAMW9vDZ3GOnDIFopq","object":"chat.completion.chunk","created":1761681305,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9739,"completion_tokens":151,"total_tokens":9890,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":128,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"1"} + data: {"id":"chatcmpl-CVxh09V8tSPjsVy251YpcNn5aEOnq","object":"chat.completion.chunk","created":1761733662,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9491,"completion_tokens":151,"total_tokens":9642,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":128,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"U5Jb"} data: [DONE] @@ -106,15 +104,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 3.696630416s + duration: 5.043511333s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44270 + content_length: 42981 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_KX6VQbRygcdVM5MH7i2zQ27o\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/glob_tool/main.go\",\"tool_call_id\":\"call_KX6VQbRygcdVM5MH7i2zQ27o\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_djbq3UQi92k8wpVk9DCI80dh\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/glob_tool/main.go\",\"tool_call_id\":\"call_djbq3UQi92k8wpVk9DCI80dh\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -130,15 +128,49 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk4bA3VLJzTgg5QPb76PxqqqqrjB","object":"chat.completion.chunk","created":1761681309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"6cP2eg5Rwj"} + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"gjFniRBBLT"} + + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"hrCQDXRIaux"} + + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"tmp"},"finish_reason":null}],"usage":null,"obfuscation":"E8QSPAKS9"} + + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/cr"},"finish_reason":null}],"usage":null,"obfuscation":"npfbdNLfU"} + + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ush"},"finish_reason":null}],"usage":null,"obfuscation":"KvuXSicLn"} + + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-test"},"finish_reason":null}],"usage":null,"obfuscation":"o6pmTsy"} + + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/Test"},"finish_reason":null}],"usage":null,"obfuscation":"6K5fWbu"} + + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Coder"},"finish_reason":null}],"usage":null,"obfuscation":"X4YrQy4"} + + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Agent"},"finish_reason":null}],"usage":null,"obfuscation":"Ret6udU"} + + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/open"},"finish_reason":null}],"usage":null,"obfuscation":"7IJj1jV"} + + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ai"},"finish_reason":null}],"usage":null,"obfuscation":"NHeHk3qIxU"} + + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-g"},"finish_reason":null}],"usage":null,"obfuscation":"knQayWtgCL"} + + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"pt"},"finish_reason":null}],"usage":null,"obfuscation":"0eS6xVgRDJ"} + + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"CJkLdJqmrrS"} + + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"5"},"finish_reason":null}],"usage":null,"obfuscation":"6oboLqrx19k"} + + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/gl"},"finish_reason":null}],"usage":null,"obfuscation":"oSezXQjUu"} + + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ob"},"finish_reason":null}],"usage":null,"obfuscation":"ekdrzjBC3O"} + + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"_tool"},"finish_reason":null}],"usage":null,"obfuscation":"6tkh9yk"} - data: {"id":"chatcmpl-CVk4bA3VLJzTgg5QPb76PxqqqqrjB","object":"chat.completion.chunk","created":1761681309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"main"},"finish_reason":null}],"usage":null,"obfuscation":"bvFO1q5Y"} + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/main"},"finish_reason":null}],"usage":null,"obfuscation":"EkrR44Z"} - data: {"id":"chatcmpl-CVk4bA3VLJzTgg5QPb76PxqqqqrjB","object":"chat.completion.chunk","created":1761681309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"ZnilL9OaM"} + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"gfsQYPIAq"} - data: {"id":"chatcmpl-CVk4bA3VLJzTgg5QPb76PxqqqqrjB","object":"chat.completion.chunk","created":1761681309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"kl9ITp"} + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"6mcvnR"} - data: {"id":"chatcmpl-CVk4bA3VLJzTgg5QPb76PxqqqqrjB","object":"chat.completion.chunk","created":1761681309,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9784,"completion_tokens":5,"total_tokens":9789,"prompt_tokens_details":{"cached_tokens":8832,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"LC6VB"} + data: {"id":"chatcmpl-CVxh5qVdepsYGHJf32YasHeVieo7W","object":"chat.completion.chunk","created":1761733667,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9536,"completion_tokens":22,"total_tokens":9558,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"JwE5"} data: [DONE] @@ -147,4 +179,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.123781625s + duration: 1.264105083s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/grep_tool.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/grep_tool.yaml index ec908fb110051116c819f2b56235929c91aa401a..606a5405a371f178a8f1c3a62b9fb04562a92a42 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/grep_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/grep_tool.yaml @@ -24,29 +24,29 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk4ekm2bWpqwYhlCYWG0HXD5Op6k","object":"chat.completion.chunk","created":1761681312,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"adfoklUySpqupF"} + data: {"id":"chatcmpl-CVxh7CMLiOysWKxFlZ2gdcgDfk1L4","object":"chat.completion.chunk","created":1761733669,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"p2dZ6SfGBobu3W"} - data: {"id":"chatcmpl-CVk4ekm2bWpqwYhlCYWG0HXD5Op6k","object":"chat.completion.chunk","created":1761681312,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"Search"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"L64GOZgifh"} + data: {"id":"chatcmpl-CVxh7CMLiOysWKxFlZ2gdcgDfk1L4","object":"chat.completion.chunk","created":1761733669,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"Searching"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"fJ0HkDR"} - data: {"id":"chatcmpl-CVk4ekm2bWpqwYhlCYWG0HXD5Op6k","object":"chat.completion.chunk","created":1761681312,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" '"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"IHBSLjjATJ6rPC"} + data: {"id":"chatcmpl-CVxh7CMLiOysWKxFlZ2gdcgDfk1L4","object":"chat.completion.chunk","created":1761733669,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" '"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"HmkqfksclKTzkQ"} - data: {"id":"chatcmpl-CVk4ekm2bWpqwYhlCYWG0HXD5Op6k","object":"chat.completion.chunk","created":1761681312,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"package"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"cn1tCbHgo"} + data: {"id":"chatcmpl-CVxh7CMLiOysWKxFlZ2gdcgDfk1L4","object":"chat.completion.chunk","created":1761733669,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"package"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"rDqQYDxlX"} - data: {"id":"chatcmpl-CVk4ekm2bWpqwYhlCYWG0HXD5Op6k","object":"chat.completion.chunk","created":1761681312,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"'"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"9X8hgRcDSQMQEX5"} + data: {"id":"chatcmpl-CVxh7CMLiOysWKxFlZ2gdcgDfk1L4","object":"chat.completion.chunk","created":1761733669,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"'"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"soOZa4i0C7svKWT"} - data: {"id":"chatcmpl-CVk4ekm2bWpqwYhlCYWG0HXD5Op6k","object":"chat.completion.chunk","created":1761681312,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"8LKklzuRTxcPC"} + data: {"id":"chatcmpl-CVxh7CMLiOysWKxFlZ2gdcgDfk1L4","object":"chat.completion.chunk","created":1761733669,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"z69knWkDznXRh"} - data: {"id":"chatcmpl-CVk4ekm2bWpqwYhlCYWG0HXD5Op6k","object":"chat.completion.chunk","created":1761681312,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"fdJcFjBuDbQkY"} + data: {"id":"chatcmpl-CVxh7CMLiOysWKxFlZ2gdcgDfk1L4","object":"chat.completion.chunk","created":1761733669,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"5FMiQ4Uwmub1z"} - data: {"id":"chatcmpl-CVk4ekm2bWpqwYhlCYWG0HXD5Op6k","object":"chat.completion.chunk","created":1761681312,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Files"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"7KepEPG67k"} + data: {"id":"chatcmpl-CVxh7CMLiOysWKxFlZ2gdcgDfk1L4","object":"chat.completion.chunk","created":1761733669,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Files"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"GZnOlB9Wha"} - data: {"id":"chatcmpl-CVk4ekm2bWpqwYhlCYWG0HXD5Op6k","object":"chat.completion.chunk","created":1761681312,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Using"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"i4JfbbTgYT"} + data: {"id":"chatcmpl-CVxh7CMLiOysWKxFlZ2gdcgDfk1L4","object":"chat.completion.chunk","created":1761733669,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" with"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"5WcMRC1CMmN"} - data: {"id":"chatcmpl-CVk4ekm2bWpqwYhlCYWG0HXD5Op6k","object":"chat.completion.chunk","created":1761681312,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" grep"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"6i8pIK1SPuy"} + data: {"id":"chatcmpl-CVxh7CMLiOysWKxFlZ2gdcgDfk1L4","object":"chat.completion.chunk","created":1761733669,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" grep"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"01zSxPpLijG"} - data: {"id":"chatcmpl-CVk4ekm2bWpqwYhlCYWG0HXD5Op6k","object":"chat.completion.chunk","created":1761681312,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"L7IhLJ0DrF"} + data: {"id":"chatcmpl-CVxh7CMLiOysWKxFlZ2gdcgDfk1L4","object":"chat.completion.chunk","created":1761733669,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"koIqz6cft6"} - data: {"id":"chatcmpl-CVk4ekm2bWpqwYhlCYWG0HXD5Op6k","object":"chat.completion.chunk","created":1761681312,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[],"usage":{"prompt_tokens":138,"completion_tokens":9,"total_tokens":147,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"RoMFkWVMpHDtEO"} + data: {"id":"chatcmpl-CVxh7CMLiOysWKxFlZ2gdcgDfk1L4","object":"chat.completion.chunk","created":1761733669,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[],"usage":{"prompt_tokens":138,"completion_tokens":9,"total_tokens":147,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"SJMjNdZ2QMMUch"} data: [DONE] @@ -55,15 +55,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.273728917s + duration: 476.912916ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 43974 + content_length: 42685 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -79,41 +79,41 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk4dgBpJjiwRFO5WqBjgfuA4Pptb","object":"chat.completion.chunk","created":1761681311,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_f5aNcyJyPyseDSBO2OXzzYw9","type":"function","function":{"name":"grep","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"HMHHIUeOY3sE"} + data: {"id":"chatcmpl-CVxh7MWlkgUbGhud8mv4MGmqPqKRX","object":"chat.completion.chunk","created":1761733669,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_GSn9s8Qkcdw75G6zExgcLyZi","type":"function","function":{"name":"grep","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"0X4RSYpdS8Fs"} - data: {"id":"chatcmpl-CVk4dgBpJjiwRFO5WqBjgfuA4Pptb","object":"chat.completion.chunk","created":1761681311,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"XLt3ikr393lD90u"} + data: {"id":"chatcmpl-CVxh7MWlkgUbGhud8mv4MGmqPqKRX","object":"chat.completion.chunk","created":1761733669,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"UV7l4LkKrB0BnNb"} - data: {"id":"chatcmpl-CVk4dgBpJjiwRFO5WqBjgfuA4Pptb","object":"chat.completion.chunk","created":1761681311,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pattern"}}]},"finish_reason":null}],"usage":null,"obfuscation":"35B7yC9ktuU"} + data: {"id":"chatcmpl-CVxh7MWlkgUbGhud8mv4MGmqPqKRX","object":"chat.completion.chunk","created":1761733669,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pattern"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gYqvOhMAlBM"} - data: {"id":"chatcmpl-CVk4dgBpJjiwRFO5WqBjgfuA4Pptb","object":"chat.completion.chunk","created":1761681311,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"8kQpEfUdiq3Fz"} + data: {"id":"chatcmpl-CVxh7MWlkgUbGhud8mv4MGmqPqKRX","object":"chat.completion.chunk","created":1761733669,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"nIVm6XwvVbeHb"} - data: {"id":"chatcmpl-CVk4dgBpJjiwRFO5WqBjgfuA4Pptb","object":"chat.completion.chunk","created":1761681311,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"package"}}]},"finish_reason":null}],"usage":null,"obfuscation":"KM2L4dJQ5VR"} + data: {"id":"chatcmpl-CVxh7MWlkgUbGhud8mv4MGmqPqKRX","object":"chat.completion.chunk","created":1761733669,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"package"}}]},"finish_reason":null}],"usage":null,"obfuscation":"YO9OtE8tSf5"} - data: {"id":"chatcmpl-CVk4dgBpJjiwRFO5WqBjgfuA4Pptb","object":"chat.completion.chunk","created":1761681311,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"F6iodP2ID5lOZ"} + data: {"id":"chatcmpl-CVxh7MWlkgUbGhud8mv4MGmqPqKRX","object":"chat.completion.chunk","created":1761733669,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"4WhK7DfS9z3sg"} - data: {"id":"chatcmpl-CVk4dgBpJjiwRFO5WqBjgfuA4Pptb","object":"chat.completion.chunk","created":1761681311,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"literal"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Vv6GPk3C4Ic"} + data: {"id":"chatcmpl-CVxh7MWlkgUbGhud8mv4MGmqPqKRX","object":"chat.completion.chunk","created":1761733669,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"include"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4YSf9Dd6L5l"} - data: {"id":"chatcmpl-CVk4dgBpJjiwRFO5WqBjgfuA4Pptb","object":"chat.completion.chunk","created":1761681311,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_text"}}]},"finish_reason":null}],"usage":null,"obfuscation":"OHQQvETasMJ6w"} + data: {"id":"chatcmpl-CVxh7MWlkgUbGhud8mv4MGmqPqKRX","object":"chat.completion.chunk","created":1761733669,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"nydzYyzFgY8kJ"} - data: {"id":"chatcmpl-CVk4dgBpJjiwRFO5WqBjgfuA4Pptb","object":"chat.completion.chunk","created":1761681311,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4CAosv3qEPpXgLa"} + data: {"id":"chatcmpl-CVxh7MWlkgUbGhud8mv4MGmqPqKRX","object":"chat.completion.chunk","created":1761733669,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"*."}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk4dgBpJjiwRFO5WqBjgfuA4Pptb","object":"chat.completion.chunk","created":1761681311,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"true"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ejnmXTANVbgqjH"} + data: {"id":"chatcmpl-CVxh7MWlkgUbGhud8mv4MGmqPqKRX","object":"chat.completion.chunk","created":1761733669,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk4dgBpJjiwRFO5WqBjgfuA4Pptb","object":"chat.completion.chunk","created":1761681311,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"dge3NCt31YkeW8V"} + data: {"id":"chatcmpl-CVxh7MWlkgUbGhud8mv4MGmqPqKRX","object":"chat.completion.chunk","created":1761733669,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Tyk6e5zGPIaGQ"} - data: {"id":"chatcmpl-CVk4dgBpJjiwRFO5WqBjgfuA4Pptb","object":"chat.completion.chunk","created":1761681311,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"include"}}]},"finish_reason":null}],"usage":null,"obfuscation":"GtEeWd0T7W9"} + data: {"id":"chatcmpl-CVxh7MWlkgUbGhud8mv4MGmqPqKRX","object":"chat.completion.chunk","created":1761733669,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"literal"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7uRU5FpftEj"} - data: {"id":"chatcmpl-CVk4dgBpJjiwRFO5WqBjgfuA4Pptb","object":"chat.completion.chunk","created":1761681311,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"CNchRPAcUJw4F"} + data: {"id":"chatcmpl-CVxh7MWlkgUbGhud8mv4MGmqPqKRX","object":"chat.completion.chunk","created":1761733669,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_text"}}]},"finish_reason":null}],"usage":null,"obfuscation":"lefdEZgkYlVBq"} - data: {"id":"chatcmpl-CVk4dgBpJjiwRFO5WqBjgfuA4Pptb","object":"chat.completion.chunk","created":1761681311,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"*."}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxh7MWlkgUbGhud8mv4MGmqPqKRX","object":"chat.completion.chunk","created":1761733669,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"o4UCVH9DjF1DqZS"} - data: {"id":"chatcmpl-CVk4dgBpJjiwRFO5WqBjgfuA4Pptb","object":"chat.completion.chunk","created":1761681311,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxh7MWlkgUbGhud8mv4MGmqPqKRX","object":"chat.completion.chunk","created":1761733669,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"true"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Yf3ijUlTttCQTz"} - data: {"id":"chatcmpl-CVk4dgBpJjiwRFO5WqBjgfuA4Pptb","object":"chat.completion.chunk","created":1761681311,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0eB6UzwTRpLDs0W"} + data: {"id":"chatcmpl-CVxh7MWlkgUbGhud8mv4MGmqPqKRX","object":"chat.completion.chunk","created":1761733669,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"J"} - data: {"id":"chatcmpl-CVk4dgBpJjiwRFO5WqBjgfuA4Pptb","object":"chat.completion.chunk","created":1761681311,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxh7MWlkgUbGhud8mv4MGmqPqKRX","object":"chat.completion.chunk","created":1761733669,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk4dgBpJjiwRFO5WqBjgfuA4Pptb","object":"chat.completion.chunk","created":1761681311,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9740,"completion_tokens":353,"total_tokens":10093,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":320,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":""} + data: {"id":"chatcmpl-CVxh7MWlkgUbGhud8mv4MGmqPqKRX","object":"chat.completion.chunk","created":1761733669,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9492,"completion_tokens":225,"total_tokens":9717,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":192,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"p"} data: [DONE] @@ -122,15 +122,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 9.132154959s + duration: 6.745695292s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44366 + content_length: 43077 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_f5aNcyJyPyseDSBO2OXzzYw9\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"package\\\",\\\"literal_text\\\":true,\\\"include\\\":\\\"*.go\\\"}\",\"name\":\"grep\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Found 1 matches\\n/tmp/crush-test/TestCoderAgent/openai-gpt-5/grep_tool/main.go:\\n Line 1, Char 1: package main\\n\",\"tool_call_id\":\"call_f5aNcyJyPyseDSBO2OXzzYw9\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_GSn9s8Qkcdw75G6zExgcLyZi\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"package\\\",\\\"include\\\":\\\"*.go\\\",\\\"literal_text\\\":true}\",\"name\":\"grep\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Found 1 matches\\n/tmp/crush-test/TestCoderAgent/openai-gpt-5/grep_tool/main.go:\\n Line 1, Char 1: package main\\n\",\"tool_call_id\":\"call_GSn9s8Qkcdw75G6zExgcLyZi\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -146,63 +146,59 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"bIimelO1t3"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"taEcOoQKv3"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"G5YUv5EzN0m"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"kMXRFds6Wvp"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"tmp"},"finish_reason":null}],"usage":null,"obfuscation":"b43qHQhba"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"tmp"},"finish_reason":null}],"usage":null,"obfuscation":"Fudp2bUAW"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/cr"},"finish_reason":null}],"usage":null,"obfuscation":"i8dCW6CQN"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/cr"},"finish_reason":null}],"usage":null,"obfuscation":"JFHzCiSb9"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ush"},"finish_reason":null}],"usage":null,"obfuscation":"VqIdVvWHM"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ush"},"finish_reason":null}],"usage":null,"obfuscation":"D9S4VU33m"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-test"},"finish_reason":null}],"usage":null,"obfuscation":"pyPjXqX"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-test"},"finish_reason":null}],"usage":null,"obfuscation":"xVwyuDj"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/Test"},"finish_reason":null}],"usage":null,"obfuscation":"x9Kwd8J"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/Test"},"finish_reason":null}],"usage":null,"obfuscation":"j7eHuPh"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Coder"},"finish_reason":null}],"usage":null,"obfuscation":"EsMcTgE"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Coder"},"finish_reason":null}],"usage":null,"obfuscation":"1gfXwBt"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Agent"},"finish_reason":null}],"usage":null,"obfuscation":"4VcSYeT"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Agent"},"finish_reason":null}],"usage":null,"obfuscation":"i15hZWH"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/open"},"finish_reason":null}],"usage":null,"obfuscation":"bi96sqi"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/open"},"finish_reason":null}],"usage":null,"obfuscation":"DJFk05u"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ai"},"finish_reason":null}],"usage":null,"obfuscation":"ibDDcfHNFU"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ai"},"finish_reason":null}],"usage":null,"obfuscation":"5Msi1h7QIZ"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-g"},"finish_reason":null}],"usage":null,"obfuscation":"F52FjBUZ1q"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-g"},"finish_reason":null}],"usage":null,"obfuscation":"o9o9Iqh3Nn"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"pt"},"finish_reason":null}],"usage":null,"obfuscation":"94xaHaoTg9"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"pt"},"finish_reason":null}],"usage":null,"obfuscation":"4nLj3tLdFW"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"i8xQmshbAXX"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"WCtygPmRIq0"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"5"},"finish_reason":null}],"usage":null,"obfuscation":"68llUKMJme2"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"5"},"finish_reason":null}],"usage":null,"obfuscation":"L67FwHdyOpq"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"hiM8gtaRG7o"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"oTq3ugcgAzt"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"grep"},"finish_reason":null}],"usage":null,"obfuscation":"TPhiG23V"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"grep"},"finish_reason":null}],"usage":null,"obfuscation":"OMr8jD6t"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"_tool"},"finish_reason":null}],"usage":null,"obfuscation":"IEc0wj2"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"_tool"},"finish_reason":null}],"usage":null,"obfuscation":"PlzgUDn"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/main"},"finish_reason":null}],"usage":null,"obfuscation":"PedCqyd"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/main"},"finish_reason":null}],"usage":null,"obfuscation":"gTxI1f1"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"ZGqXPPjnI"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"rkyTz4t3h"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":"},"finish_reason":null}],"usage":null,"obfuscation":"eoX1V5KWol0"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":"},"finish_reason":null}],"usage":null,"obfuscation":"QlAz5mCpbng"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"1"},"finish_reason":null}],"usage":null,"obfuscation":"i4QttseCEZR"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"1"},"finish_reason":null}],"usage":null,"obfuscation":"KA5t8NYW5Bg"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":"},"finish_reason":null}],"usage":null,"obfuscation":"4d5lg5DHx0H"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":"},"finish_reason":null}],"usage":null,"obfuscation":"7qe9RqHKWcs"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"1"},"finish_reason":null}],"usage":null,"obfuscation":"GevgdNB2Zvt"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" package"},"finish_reason":null}],"usage":null,"obfuscation":"Dupv"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":"},"finish_reason":null}],"usage":null,"obfuscation":"WgxRJGeYLVq"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" main"},"finish_reason":null}],"usage":null,"obfuscation":"GvvWP5W"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" package"},"finish_reason":null}],"usage":null,"obfuscation":"fmQK"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"EiqVZx"} - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" main"},"finish_reason":null}],"usage":null,"obfuscation":"lk3xmJ1"} - - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"90kprB"} - - data: {"id":"chatcmpl-CVk4nKSlw3DL33IwpkJg0hPdHguqg","object":"chat.completion.chunk","created":1761681321,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9813,"completion_tokens":29,"total_tokens":9842,"prompt_tokens_details":{"cached_tokens":8832,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"A4OK"} + data: {"id":"chatcmpl-CVxhErbeWf4nn9ApghHsblLmplljO","object":"chat.completion.chunk","created":1761733676,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9565,"completion_tokens":27,"total_tokens":9592,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"Q7aj"} data: [DONE] @@ -211,4 +207,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.129783542s + duration: 3.335876083s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/ls_tool.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/ls_tool.yaml index 5a1a8ce3542480e5cb278190a35e7c803222fc76..665c8d15b480105bb259757e1a3fc98126c62a84 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/ls_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/ls_tool.yaml @@ -24,29 +24,25 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk4pHPQXxKX0iaeD7YJwV1kN5MTP","object":"chat.completion.chunk","created":1761681323,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"hcB3ARTRN2hfCM"} + data: {"id":"chatcmpl-CVxhHyJqdCwGQtDrKyvvJtDrclXnA","object":"chat.completion.chunk","created":1761733679,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"OUcCFsf9plfLIw"} - data: {"id":"chatcmpl-CVk4pHPQXxKX0iaeD7YJwV1kN5MTP","object":"chat.completion.chunk","created":1761681323,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"Listing"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"5ZPo9s0L3"} + data: {"id":"chatcmpl-CVxhHyJqdCwGQtDrKyvvJtDrclXnA","object":"chat.completion.chunk","created":1761733679,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"Listing"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"zf0U5lCiD"} - data: {"id":"chatcmpl-CVk4pHPQXxKX0iaeD7YJwV1kN5MTP","object":"chat.completion.chunk","created":1761681323,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Files"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"0jLXDtZyrm"} + data: {"id":"chatcmpl-CVxhHyJqdCwGQtDrKyvvJtDrclXnA","object":"chat.completion.chunk","created":1761733679,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Files"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"sfdr3DM1Jf"} - data: {"id":"chatcmpl-CVk4pHPQXxKX0iaeD7YJwV1kN5MTP","object":"chat.completion.chunk","created":1761681323,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"vXVFwgPdDSDkD"} + data: {"id":"chatcmpl-CVxhHyJqdCwGQtDrKyvvJtDrclXnA","object":"chat.completion.chunk","created":1761733679,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" with"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"kfgl3WErrrJ"} - data: {"id":"chatcmpl-CVk4pHPQXxKX0iaeD7YJwV1kN5MTP","object":"chat.completion.chunk","created":1761681323,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Current"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"lByqa5mY"} + data: {"id":"chatcmpl-CVxhHyJqdCwGQtDrKyvvJtDrclXnA","object":"chat.completion.chunk","created":1761733679,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" '"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"afNDkcYCz6uDaX"} - data: {"id":"chatcmpl-CVk4pHPQXxKX0iaeD7YJwV1kN5MTP","object":"chat.completion.chunk","created":1761681323,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Directory"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"4fkSK6"} + data: {"id":"chatcmpl-CVxhHyJqdCwGQtDrKyvvJtDrclXnA","object":"chat.completion.chunk","created":1761733679,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"ls"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"zqzkSTfCokPeVW"} - data: {"id":"chatcmpl-CVk4pHPQXxKX0iaeD7YJwV1kN5MTP","object":"chat.completion.chunk","created":1761681323,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Using"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"iXfZoanfKb"} + data: {"id":"chatcmpl-CVxhHyJqdCwGQtDrKyvvJtDrclXnA","object":"chat.completion.chunk","created":1761733679,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"'"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"wmkFiII0Y9Oa2qb"} - data: {"id":"chatcmpl-CVk4pHPQXxKX0iaeD7YJwV1kN5MTP","object":"chat.completion.chunk","created":1761681323,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" '"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"z2sF6lm2zHQAOS"} + data: {"id":"chatcmpl-CVxhHyJqdCwGQtDrKyvvJtDrclXnA","object":"chat.completion.chunk","created":1761733679,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Command"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"MXHRRbN7"} - data: {"id":"chatcmpl-CVk4pHPQXxKX0iaeD7YJwV1kN5MTP","object":"chat.completion.chunk","created":1761681323,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"ls"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"QEi72tRnDpU3JD"} + data: {"id":"chatcmpl-CVxhHyJqdCwGQtDrKyvvJtDrclXnA","object":"chat.completion.chunk","created":1761733679,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"iIIkNaa1OO"} - data: {"id":"chatcmpl-CVk4pHPQXxKX0iaeD7YJwV1kN5MTP","object":"chat.completion.chunk","created":1761681323,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"'"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"t9TBEy2XKZgVZEb"} - - data: {"id":"chatcmpl-CVk4pHPQXxKX0iaeD7YJwV1kN5MTP","object":"chat.completion.chunk","created":1761681323,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"xIxGuXpOJK"} - - data: {"id":"chatcmpl-CVk4pHPQXxKX0iaeD7YJwV1kN5MTP","object":"chat.completion.chunk","created":1761681323,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[],"usage":{"prompt_tokens":135,"completion_tokens":9,"total_tokens":144,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"nSdpczn6e5A5rc"} + data: {"id":"chatcmpl-CVxhHyJqdCwGQtDrKyvvJtDrclXnA","object":"chat.completion.chunk","created":1761733679,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[],"usage":{"prompt_tokens":135,"completion_tokens":7,"total_tokens":142,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"KW58RCA9aKzZ87"} data: [DONE] @@ -55,15 +51,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 688.16175ms + duration: 542.968958ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 43968 + content_length: 42679 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -79,31 +75,21 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk4prd8gt8HcNFQRwI3vOYP8i8E1","object":"chat.completion.chunk","created":1761681323,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_mgSV8QI8XRROYWeVKyjgHNqf","type":"function","function":{"name":"ls","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"xCYZ9xnh2sGTRD"} - - data: {"id":"chatcmpl-CVk4prd8gt8HcNFQRwI3vOYP8i8E1","object":"chat.completion.chunk","created":1761681323,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"QjExKlD2rDoLbES"} - - data: {"id":"chatcmpl-CVk4prd8gt8HcNFQRwI3vOYP8i8E1","object":"chat.completion.chunk","created":1761681323,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Kfce9doRXAKpWX"} - - data: {"id":"chatcmpl-CVk4prd8gt8HcNFQRwI3vOYP8i8E1","object":"chat.completion.chunk","created":1761681323,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"RO26UgWowibpGlB"} - - data: {"id":"chatcmpl-CVk4prd8gt8HcNFQRwI3vOYP8i8E1","object":"chat.completion.chunk","created":1761681323,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \".\","}}]},"finish_reason":null}],"usage":null,"obfuscation":"t2xD1lGqqam"} - - data: {"id":"chatcmpl-CVk4prd8gt8HcNFQRwI3vOYP8i8E1","object":"chat.completion.chunk","created":1761681323,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \""}}]},"finish_reason":null}],"usage":null,"obfuscation":"pWmSBJDPOF85i7e"} + data: {"id":"chatcmpl-CVxhHum7d1fLob7wQbTs4c6dUeYRp","object":"chat.completion.chunk","created":1761733679,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_DnEfNg47tkE6i8f1xvrnycf4","type":"function","function":{"name":"ls","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"lmr4yDSHCwawh6"} - data: {"id":"chatcmpl-CVk4prd8gt8HcNFQRwI3vOYP8i8E1","object":"chat.completion.chunk","created":1761681323,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"depth"}}]},"finish_reason":null}],"usage":null,"obfuscation":"zpZ3QmWVtqpa2"} + data: {"id":"chatcmpl-CVxhHum7d1fLob7wQbTs4c6dUeYRp","object":"chat.completion.chunk","created":1761733679,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"V5l62Iw5tXtuI1N"} - data: {"id":"chatcmpl-CVk4prd8gt8HcNFQRwI3vOYP8i8E1","object":"chat.completion.chunk","created":1761681323,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"tN1vsB25PNxt1zN"} + data: {"id":"chatcmpl-CVxhHum7d1fLob7wQbTs4c6dUeYRp","object":"chat.completion.chunk","created":1761733679,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"zMlaaPpmBHiiRs"} - data: {"id":"chatcmpl-CVk4prd8gt8HcNFQRwI3vOYP8i8E1","object":"chat.completion.chunk","created":1761681323,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" "}}]},"finish_reason":null}],"usage":null,"obfuscation":"x"} + data: {"id":"chatcmpl-CVxhHum7d1fLob7wQbTs4c6dUeYRp","object":"chat.completion.chunk","created":1761733679,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"tVnv5U8Ic8lqfgQ"} - data: {"id":"chatcmpl-CVk4prd8gt8HcNFQRwI3vOYP8i8E1","object":"chat.completion.chunk","created":1761681323,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"1"}}]},"finish_reason":null}],"usage":null,"obfuscation":"n"} + data: {"id":"chatcmpl-CVxhHum7d1fLob7wQbTs4c6dUeYRp","object":"chat.completion.chunk","created":1761733679,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \".\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"P6NuqcNrrnyl"} - data: {"id":"chatcmpl-CVk4prd8gt8HcNFQRwI3vOYP8i8E1","object":"chat.completion.chunk","created":1761681323,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"H"} + data: {"id":"chatcmpl-CVxhHum7d1fLob7wQbTs4c6dUeYRp","object":"chat.completion.chunk","created":1761733679,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"k"} - data: {"id":"chatcmpl-CVk4prd8gt8HcNFQRwI3vOYP8i8E1","object":"chat.completion.chunk","created":1761681323,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhHum7d1fLob7wQbTs4c6dUeYRp","object":"chat.completion.chunk","created":1761733679,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk4prd8gt8HcNFQRwI3vOYP8i8E1","object":"chat.completion.chunk","created":1761681323,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9737,"completion_tokens":92,"total_tokens":9829,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":64,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"jL6"} + data: {"id":"chatcmpl-CVxhHum7d1fLob7wQbTs4c6dUeYRp","object":"chat.completion.chunk","created":1761733679,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9489,"completion_tokens":87,"total_tokens":9576,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":64,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"IWMJq1"} data: [DONE] @@ -112,15 +98,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 3.403825875s + duration: 5.672162542s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44291 + content_length: 42988 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_mgSV8QI8XRROYWeVKyjgHNqf\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\".\\\", \\\"depth\\\": 1}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/ls_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_mgSV8QI8XRROYWeVKyjgHNqf\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_DnEfNg47tkE6i8f1xvrnycf4\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\".\\\"}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/ls_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_DnEfNg47tkE6i8f1xvrnycf4\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -136,21 +122,21 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk4tt1dJxsGdqogAcYg4HbMyshVX","object":"chat.completion.chunk","created":1761681327,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"4vrG6Qa0vt"} + data: {"id":"chatcmpl-CVxhNHkiPG5IptbuXKoStGUEDs2rH","object":"chat.completion.chunk","created":1761733685,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"crj2JSFQcg"} - data: {"id":"chatcmpl-CVk4tt1dJxsGdqogAcYg4HbMyshVX","object":"chat.completion.chunk","created":1761681327,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"go"},"finish_reason":null}],"usage":null,"obfuscation":"2gMe8Zdk3E"} + data: {"id":"chatcmpl-CVxhNHkiPG5IptbuXKoStGUEDs2rH","object":"chat.completion.chunk","created":1761733685,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"go"},"finish_reason":null}],"usage":null,"obfuscation":"B7ZaIatpRy"} - data: {"id":"chatcmpl-CVk4tt1dJxsGdqogAcYg4HbMyshVX","object":"chat.completion.chunk","created":1761681327,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".mod"},"finish_reason":null}],"usage":null,"obfuscation":"WUL9uVI7"} + data: {"id":"chatcmpl-CVxhNHkiPG5IptbuXKoStGUEDs2rH","object":"chat.completion.chunk","created":1761733685,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".mod"},"finish_reason":null}],"usage":null,"obfuscation":"ncGUi4Lr"} - data: {"id":"chatcmpl-CVk4tt1dJxsGdqogAcYg4HbMyshVX","object":"chat.completion.chunk","created":1761681327,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":","},"finish_reason":null}],"usage":null,"obfuscation":"EdvyHi5fMLG"} + data: {"id":"chatcmpl-CVxhNHkiPG5IptbuXKoStGUEDs2rH","object":"chat.completion.chunk","created":1761733685,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":","},"finish_reason":null}],"usage":null,"obfuscation":"Au8YyUmHhqh"} - data: {"id":"chatcmpl-CVk4tt1dJxsGdqogAcYg4HbMyshVX","object":"chat.completion.chunk","created":1761681327,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" main"},"finish_reason":null}],"usage":null,"obfuscation":"aQKikmA"} + data: {"id":"chatcmpl-CVxhNHkiPG5IptbuXKoStGUEDs2rH","object":"chat.completion.chunk","created":1761733685,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" main"},"finish_reason":null}],"usage":null,"obfuscation":"DFH8t9M"} - data: {"id":"chatcmpl-CVk4tt1dJxsGdqogAcYg4HbMyshVX","object":"chat.completion.chunk","created":1761681327,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"AjJuZqLAY"} + data: {"id":"chatcmpl-CVxhNHkiPG5IptbuXKoStGUEDs2rH","object":"chat.completion.chunk","created":1761733685,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"57sSxT2fH"} - data: {"id":"chatcmpl-CVk4tt1dJxsGdqogAcYg4HbMyshVX","object":"chat.completion.chunk","created":1761681327,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"sBuC5T"} + data: {"id":"chatcmpl-CVxhNHkiPG5IptbuXKoStGUEDs2rH","object":"chat.completion.chunk","created":1761733685,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"MDQuMK"} - data: {"id":"chatcmpl-CVk4tt1dJxsGdqogAcYg4HbMyshVX","object":"chat.completion.chunk","created":1761681327,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9798,"completion_tokens":8,"total_tokens":9806,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"Wj6M8"} + data: {"id":"chatcmpl-CVxhNHkiPG5IptbuXKoStGUEDs2rH","object":"chat.completion.chunk","created":1761733685,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9546,"completion_tokens":8,"total_tokens":9554,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"j8nAn"} data: [DONE] @@ -159,4 +145,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.575351167s + duration: 1.904104042s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/multiedit_tool.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/multiedit_tool.yaml index b2c35d64555d98e08b2dd98dd70bea7cdd81ba27..c7d27f86a5127a78de902d20bd91d58a49f4f3d8 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/multiedit_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/multiedit_tool.yaml @@ -24,27 +24,29 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVkL6wNBxzykcxxBZfbYFlPJQDXke","object":"chat.completion.chunk","created":1761682332,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"dLa3qhSGJU44fX"} + data: {"id":"chatcmpl-CVxhPQMVtd7SrmIv02t724jvc6dWi","object":"chat.completion.chunk","created":1761733687,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"LnicSn4wD8GWRf"} - data: {"id":"chatcmpl-CVkL6wNBxzykcxxBZfbYFlPJQDXke","object":"chat.completion.chunk","created":1761682332,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"Edit"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"mKp55kq7QD4k"} + data: {"id":"chatcmpl-CVxhPQMVtd7SrmIv02t724jvc6dWi","object":"chat.completion.chunk","created":1761733687,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"Use"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"IZXdo9VmdCdZF"} - data: {"id":"chatcmpl-CVkL6wNBxzykcxxBZfbYFlPJQDXke","object":"chat.completion.chunk","created":1761682332,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Code"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"Nhz6AjZvPor"} + data: {"id":"chatcmpl-CVxhPQMVtd7SrmIv02t724jvc6dWi","object":"chat.completion.chunk","created":1761733687,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Mult"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"wUkBVGdm2ug"} - data: {"id":"chatcmpl-CVkL6wNBxzykcxxBZfbYFlPJQDXke","object":"chat.completion.chunk","created":1761682332,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" and"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"TDITbv5IO0FI"} + data: {"id":"chatcmpl-CVxhPQMVtd7SrmIv02t724jvc6dWi","object":"chat.completion.chunk","created":1761733687,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"ied"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"lw2EnKthwLacq"} - data: {"id":"chatcmpl-CVkL6wNBxzykcxxBZfbYFlPJQDXke","object":"chat.completion.chunk","created":1761682332,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Add"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"JCygqg8WnBV4"} + data: {"id":"chatcmpl-CVxhPQMVtd7SrmIv02t724jvc6dWi","object":"chat.completion.chunk","created":1761733687,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"it"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"momAyIo7whNmLs"} - data: {"id":"chatcmpl-CVkL6wNBxzykcxxBZfbYFlPJQDXke","object":"chat.completion.chunk","created":1761682332,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Comment"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"CwcMuXtY"} + data: {"id":"chatcmpl-CVxhPQMVtd7SrmIv02t724jvc6dWi","object":"chat.completion.chunk","created":1761733687,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" to"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"Edy1cOVKQrsPf"} - data: {"id":"chatcmpl-CVkL6wNBxzykcxxBZfbYFlPJQDXke","object":"chat.completion.chunk","created":1761682332,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"Qtp3jwJNkRM3F"} + data: {"id":"chatcmpl-CVxhPQMVtd7SrmIv02t724jvc6dWi","object":"chat.completion.chunk","created":1761733687,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Modify"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"g20g3cbE3"} - data: {"id":"chatcmpl-CVkL6wNBxzykcxxBZfbYFlPJQDXke","object":"chat.completion.chunk","created":1761682332,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" main"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"bdOmBpaMuVw"} + data: {"id":"chatcmpl-CVxhPQMVtd7SrmIv02t724jvc6dWi","object":"chat.completion.chunk","created":1761733687,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Main"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"Y7JnFnjHGBp"} - data: {"id":"chatcmpl-CVkL6wNBxzykcxxBZfbYFlPJQDXke","object":"chat.completion.chunk","created":1761682332,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":".go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"7d9X8p9QMO6Vy"} + data: {"id":"chatcmpl-CVxhPQMVtd7SrmIv02t724jvc6dWi","object":"chat.completion.chunk","created":1761733687,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":".go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"a2IGxZTNuslXm"} - data: {"id":"chatcmpl-CVkL6wNBxzykcxxBZfbYFlPJQDXke","object":"chat.completion.chunk","created":1761682332,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"lxeweVsgZ6"} + data: {"id":"chatcmpl-CVxhPQMVtd7SrmIv02t724jvc6dWi","object":"chat.completion.chunk","created":1761733687,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Greeting"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"hAabjEt"} - data: {"id":"chatcmpl-CVkL6wNBxzykcxxBZfbYFlPJQDXke","object":"chat.completion.chunk","created":1761682332,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[],"usage":{"prompt_tokens":157,"completion_tokens":8,"total_tokens":165,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"6HWYS5o2ghzOP8"} + data: {"id":"chatcmpl-CVxhPQMVtd7SrmIv02t724jvc6dWi","object":"chat.completion.chunk","created":1761733687,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"kezhecR5hZ"} + + data: {"id":"chatcmpl-CVxhPQMVtd7SrmIv02t724jvc6dWi","object":"chat.completion.chunk","created":1761733687,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[],"usage":{"prompt_tokens":157,"completion_tokens":9,"total_tokens":166,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"MlDqdY6ew20bYP"} data: [DONE] @@ -53,15 +55,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 759.762875ms + duration: 464.908125ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44054 + content_length: 42765 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -77,69 +79,69 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_4S7Wdy2QOZEbpwAllfgP2VVA","type":"function","function":{"name":"ls","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"uYSyyLbc9ayXYT"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_2kfvT9YLjB55KgVqjOkoY0n9","type":"function","function":{"name":"ls","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"uVtMzdzHZYLlM9"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"TUtAuJ56sQt40lk"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"OBheFqQMeAVRS2f"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TnyFqVFDJxer5G"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ovUpTbynEErKdC"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2WgsEheZ8TDGgfC"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yg8m089xJUAhZfJ"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"H7rFS6If4YGnVV"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dHxLx0PuvHNLsa"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"wuq10kIVpc3HkRJ"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"w0gzkeIQG6hOLwI"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"HPZjiJ4PJeLw9FL"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"nX9IJD0tVyXesmy"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Hl6U6Q4MmZSmPls"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"cmzGY3foOE2IO33"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9WdakSUuT9wDX"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8gxlhIcgUaqdt"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"08Wb5uvpeQsEI"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"hnjlhHL6sh9RE"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"bSfLO7gfuUTEA"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xOaKygwKavpjW"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"V4o6C4Si09Zz7"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"U6mfSXUZYHS8r"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"cT1htXpIGq5HZ"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"iPjgwhPDJODb7"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"r"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"y"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"b"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/m"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/m"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ult"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7L8kIG58MKXWq27"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ult"}}]},"finish_reason":null}],"usage":null,"obfuscation":"RLYxFhMEpnWvDFQ"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ied"}}]},"finish_reason":null}],"usage":null,"obfuscation":"t6Ek1EKheA8PbhP"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ied"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kUm611h4X7tYo3w"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"it"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"it"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"I2TGaktIgHzuQ"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"udItw3v51XkR9"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\","}}]},"finish_reason":null}],"usage":null,"obfuscation":"kd8Ozyo0C1dwuX8"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\","}}]},"finish_reason":null}],"usage":null,"obfuscation":"H2FtDSyaNgEza8T"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \""}}]},"finish_reason":null}],"usage":null,"obfuscation":"FlDys7nSS4yykA8"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Nm29HpI4PnNcrKP"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"depth"}}]},"finish_reason":null}],"usage":null,"obfuscation":"u1FiE43f6W6bY"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"depth"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ZfcfeqCLWG9Ee"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ZdilO6Txd9RfvVM"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"x4ixKnnWrnqjoCx"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" "}}]},"finish_reason":null}],"usage":null,"obfuscation":"x"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" "}}]},"finish_reason":null}],"usage":null,"obfuscation":"c"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"2"}}]},"finish_reason":null}],"usage":null,"obfuscation":"R"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"2"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Q"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9"} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkL7SuJuKDN7xclggsiCTmhPXx2W","object":"chat.completion.chunk","created":1761682333,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9761,"completion_tokens":111,"total_tokens":9872,"prompt_tokens_details":{"cached_tokens":8832,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":64,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"C9"} + data: {"id":"chatcmpl-CVxhPDi25TQNZTUSHhCzxFLQkWVOZ","object":"chat.completion.chunk","created":1761733687,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9513,"completion_tokens":111,"total_tokens":9624,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":64,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"Ol"} data: [DONE] @@ -148,15 +150,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 5.0130425s + duration: 3.477606875s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44441 + content_length: 43152 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_4S7Wdy2QOZEbpwAllfgP2VVA\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_4S7Wdy2QOZEbpwAllfgP2VVA\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_2kfvT9YLjB55KgVqjOkoY0n9\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_2kfvT9YLjB55KgVqjOkoY0n9\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -172,63 +174,63 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_bSThtqcSldXdyvJ5RffRahkA","type":"function","function":{"name":"view","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"1XCBqlMnsoJg"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_hzMBBbJYw5H7ZTrVjS1GHrpw","type":"function","function":{"name":"view","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"FKyvw1xaYY1b"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"3TSRIDMnwNul5mj"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"0n7WA6c1EHyHw7q"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"evV9WVEc6uv3Ef"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"DOllvNbB5AB4Ej"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"797hSed1b8nGm"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"GdwSEvgJU2w25"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TOaEjVzaWSZjJOm"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"bNbjA5lSCBLn0bk"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"10UrtOCtG2yQVvj"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4KFfOMwn8Cl0rqz"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"pmucQ38y2GKSCts"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"C7NgFWXigzuoApR"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"cVuKLjp7QEAikgh"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"A71J1O9SluHjDK7"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"aQQ3pyhUT0cNqms"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Oxn5ofl3IzeVVBx"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dEW87zvf26Ps9"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"nCxlePd7dcju5"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gxJFycaR1JAQy"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"hXymXK7kf6oAy"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"GZfdzKFgRumEu"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"UdFNn5LIE23fI"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Jko1jn7lidjsj"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Tlfl60dYpY1uT"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2bBSebFB2e5kt"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"HKhuShEcM24AL"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"h"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"b"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"N"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/m"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/m"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ult"}}]},"finish_reason":null}],"usage":null,"obfuscation":"cpoZTLqFa80izKa"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ult"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ISwAcKXQM4tBUZ9"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ied"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Y4LM4A5c4QRJKCR"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ied"}}]},"finish_reason":null}],"usage":null,"obfuscation":"EYFpGfKdwzke11T"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"it"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"it"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"bZtRif0rrEjCg"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"thQsu4lrEJLWT"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"lRUmp83zFiGzQ"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"hdF8qMzK2eXJq"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"JyU4ewS45EuGRAJ"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"SkK71QRBHighVFX"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"N5A1sSj1YzHKAxl"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"QfAYH9dgWRud2bZ"} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkLCypE4VOF7zknla7zcc4QpmLrc","object":"chat.completion.chunk","created":1761682338,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9842,"completion_tokens":37,"total_tokens":9879,"prompt_tokens_details":{"cached_tokens":8832,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"3Yu6"} + data: {"id":"chatcmpl-CVxhTlWqonr13VMrnrRQgzMWJVNND","object":"chat.completion.chunk","created":1761733691,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9594,"completion_tokens":37,"total_tokens":9631,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"VQP4"} data: [DONE] @@ -237,15 +239,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.833785916s + duration: 1.44895s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44890 + content_length: 43601 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_4S7Wdy2QOZEbpwAllfgP2VVA\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_4S7Wdy2QOZEbpwAllfgP2VVA\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_bSThtqcSldXdyvJ5RffRahkA\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_bSThtqcSldXdyvJ5RffRahkA\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_2kfvT9YLjB55KgVqjOkoY0n9\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_2kfvT9YLjB55KgVqjOkoY0n9\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_hzMBBbJYw5H7ZTrVjS1GHrpw\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_hzMBBbJYw5H7ZTrVjS1GHrpw\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -261,221 +263,165 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_RL2V0zWbfuB7GdSzYwyTI3b4","type":"function","function":{"name":"multiedit","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"2h1M4Mh"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"kSQFs4CxLVgf8VG"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TP3jaCmoJ1Xt10"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"510rGcmEaZmlZ"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"bVZh55O0vpOBbZc"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kuUxnuCvKcmUI2b"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"KxfVo9TfmACaNKm"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"HyxGTkVo8qad2Wf"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Uc8zM5zkXwzgGML"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TSjbAZjXdWqM9"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"F8JSreInvi9fk"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"o3Tn2HngGabjQ"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"biQ4fGmEhyUYZ"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"mItvXIRd9omVN"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_qP9UOeJX7RQw5rXbYy3RDSJN","type":"function","function":{"name":"multiedit","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"4lwo1HW"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"smrXyXfbFmVYXBn"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"s"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"obxLcimv7IuSOM"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"G"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6Nm9yDxbPS3W0"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/m"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"itBD4DTzcEPl9Ff"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ult"}}]},"finish_reason":null}],"usage":null,"obfuscation":"cK0ki1Yx2lmqjIa"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"i5nzF5xNqAMlU2U"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ied"}}]},"finish_reason":null}],"usage":null,"obfuscation":"EEltEgVnQfmdFAb"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"CUupBhgAS4DAxyl"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"it"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PdPHFAyMMTLFfTA"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Eu3cKs6jq9tKB"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1dd5REXwNMxyhxF"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"DsFlhY1dtPyUr"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"YIFjtMZ02Y8bv"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4NRLNS1Va87BICS"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"liMpMmGzRJuRk"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"BIfDUTRY2dObc"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Q2XtEExOkBrxb"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ed"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"nMjPD0BkKVOpx"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"its"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qKCFZ6UhhjjLRo5"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"egHghuKJdPvhU"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":["}}]},"finish_reason":null}],"usage":null,"obfuscation":"ymvttYIIC6pN0n"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"5151E1LcYRfiiAB"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"old"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qGjJPaHiASNaifu"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gLpWIHmPPkt"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"N1sYIrtcZaxgY"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"i"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"func"}}]},"finish_reason":null}],"usage":null,"obfuscation":"OlqM6AmlflEKje"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/m"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"VxHprReL8gpi9"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ult"}}]},"finish_reason":null}],"usage":null,"obfuscation":"rQ47gckLA5b1gNW"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"()"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ied"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qpM288ZnWMqZcLX"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" {\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Kg2QSB5cNKzLxx"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"it"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"X"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"pM1XepagvAQwE"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\t"}}]},"finish_reason":null}],"usage":null,"obfuscation":"uGCQp0R5MgPe0PS"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"RluCxJral9GKf"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"fmt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Xxd0lJMz4Rmqr5r"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"J8dZQYDMA2NvEjh"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"iqhWCwHONt"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"E7X4E8durvyiy"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"8Y3TwtOQzZx4Y"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ed"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"cA1OrOL4Mmqgj"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"its"}}]},"finish_reason":null}],"usage":null,"obfuscation":"KkiTNxyepuw5jGG"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":","}}]},"finish_reason":null}],"usage":null,"obfuscation":"B"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":["}}]},"finish_reason":null}],"usage":null,"obfuscation":"Q31hN1erBKC0Dm"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" World"}}]},"finish_reason":null}],"usage":null,"obfuscation":"rqRVQFfFXRGL"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"fS4q1jvcw8GpXAa"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"!\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"VxqD3fYOUPQsZRD"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"old"}}]},"finish_reason":null}],"usage":null,"obfuscation":"QzWzuMHTS7VclZm"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"oCT0BrXjRWjH434"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0ED9oAfJkXh"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"RXWSYfOxy4RvM"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"A"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"func"}}]},"finish_reason":null}],"usage":null,"obfuscation":"YuByaF3eweU6JD"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"CXRN84bCetmmJ"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"jZMKKHFaUGtQK"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"()"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"new"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Y216GuRVK4zsJGV"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" {\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qwX1Fdb1Zh1GDw"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Q1g6uGy96KD"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"B"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"sKUywGS8vCBeU"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\t"}}]},"finish_reason":null}],"usage":null,"obfuscation":"SSoODcHxLYRlGkh"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"func"}}]},"finish_reason":null}],"usage":null,"obfuscation":"pstyd4jUpLBE2F"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"fmt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3XviAAwo1MIiu5w"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"01dbPKpCJ2ndk"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8DFkkegcUT"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"()"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"fCANrXsvFboqQ"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" {\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Zf3UyL92Jkam4y"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7Js4M0E1ZMGA7"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"I"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":","}}]},"finish_reason":null}],"usage":null,"obfuscation":"I"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\t"}}]},"finish_reason":null}],"usage":null,"obfuscation":"phoroVV4En5Chgp"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" World"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7rpddmdyb6UT"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"//"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"!\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"fLVQafjcdE1JTFY"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Greeting"}}]},"finish_reason":null}],"usage":null,"obfuscation":"hXVog9aGa"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"NhhQiU8BqM2VBga"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dDP2FWoPVBxikTx"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\t"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ODuyniADUq0rb8A"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"R"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"fmt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"i0CC3lFkXxg13xs"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gWHoEsS7zW"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"UfB5gPoqdlA8y"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"UfHlG8fy2hj3C"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"new"}}]},"finish_reason":null}],"usage":null,"obfuscation":"fUWmJVPUAQl3zYl"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1eu2W6yVTlxGV"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vM5VjbRb1Lg"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":","}}]},"finish_reason":null}],"usage":null,"obfuscation":"J"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"k6WMTGytSlaqP"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" World"}}]},"finish_reason":null}],"usage":null,"obfuscation":"tvjJ0AqFMRmb"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"func"}}]},"finish_reason":null}],"usage":null,"obfuscation":"sOHsdisII0eF7Y"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"!\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"cnpTWpeajhL5rKb"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"lJhwH9eh2n501"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"RtRJnuYbpIR8IZY"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"()"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" {\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3wqjYelQV0JBd0"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"U"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"O"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"fDJcZYKeyRkFpvW"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\t"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0UWGwyW4qRZwNGq"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"},{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"7kJwhIsDE9ZY0"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"//"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"old"}}]},"finish_reason":null}],"usage":null,"obfuscation":"mySwLTDOJDfJWiF"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Greeting"}}]},"finish_reason":null}],"usage":null,"obfuscation":"fylaHsKxn"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"A7JunGJX9kb"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PzEuSSty6StX3So"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"SomZX30PBY2Pu"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\t"}}]},"finish_reason":null}],"usage":null,"obfuscation":"MBemf5vRd3hh7Bq"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"fmt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"tzlvROxEIjVrQB7"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tf"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1SiY0tt2vF"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"mt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"vFYpkYCaNXDrK"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4ZEXR6vRvS"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"d7LHLi829UJe4"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"aNx5hMQFa0rWP"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":","}}]},"finish_reason":null}],"usage":null,"obfuscation":"1"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xPlXIWkrdC6k8"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Crush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"WEjYm8NNFBfd"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":","}}]},"finish_reason":null}],"usage":null,"obfuscation":"g"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"!\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"JLH2LTXebOHu99S"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" World"}}]},"finish_reason":null}],"usage":null,"obfuscation":"FogbQDMGHGgh"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"c3YJTsPlBChQhg3"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"!\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"eKi90sqfHy3StmO"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9dSd5RqUB2JvpD5"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"t"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"RTJ6boCFrpB1n"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"U"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"new"}}]},"finish_reason":null}],"usage":null,"obfuscation":"pq3XfgK2UWjI2Sv"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6qxoyjGl6DPuedF"} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0CJf1ImgkWh"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"]}"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"DHsgNnHSXYP65"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tf"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"mt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"szOhrW9FMm"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"b8oM8s2mi86Lz"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"MLg1VyA5Yynfa"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":","}}]},"finish_reason":null}],"usage":null,"obfuscation":"H"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Crush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"c3xhRPOfbyND"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"!\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ZqNH3Z4CS2xkhYX"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Y8piFNZdNYiQoyL"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qanJmfuBRUfrYG5"} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"]}"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CVkLD9mExqX7RCP0u56Mbgo8WbYAW","object":"chat.completion.chunk","created":1761682339,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9941,"completion_tokens":1404,"total_tokens":11345,"prompt_tokens_details":{"cached_tokens":8832,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":1280,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"I6IEORXXoWV4Q6"} + data: {"id":"chatcmpl-CVxhVpJW3grDLsowfzdkpcz6GGDKe","object":"chat.completion.chunk","created":1761733693,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9693,"completion_tokens":90,"total_tokens":9783,"prompt_tokens_details":{"cached_tokens":8832,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"ekTU"} data: [DONE] @@ -484,15 +430,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 49.235919625s + duration: 2.49714225s - id: 4 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45607 + content_length: 44202 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_4S7Wdy2QOZEbpwAllfgP2VVA\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_4S7Wdy2QOZEbpwAllfgP2VVA\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_bSThtqcSldXdyvJ5RffRahkA\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_bSThtqcSldXdyvJ5RffRahkA\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_RL2V0zWbfuB7GdSzYwyTI3b4\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\",\\\"edits\\\":[{\\\"old_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\\n}\\\",\\\"new_string\\\":\\\"func main() {\\\\n\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\\n}\\\"},{\\\"old_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\",\\\"new_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\"}]}\",\"name\":\"multiedit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nApplied 2 edits to file: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\n\\n\",\"tool_call_id\":\"call_RL2V0zWbfuB7GdSzYwyTI3b4\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_2kfvT9YLjB55KgVqjOkoY0n9\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_2kfvT9YLjB55KgVqjOkoY0n9\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_hzMBBbJYw5H7ZTrVjS1GHrpw\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_hzMBBbJYw5H7ZTrVjS1GHrpw\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_qP9UOeJX7RQw5rXbYy3RDSJN\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\",\\\"edits\\\":[{\\\"old_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\\n}\\\",\\\"new_string\\\":\\\"func main() {\\\\n\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\\n}\\\"}]}\",\"name\":\"multiedit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nApplied 1 edits to file: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\n\\n\",\"tool_call_id\":\"call_qP9UOeJX7RQw5rXbYy3RDSJN\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -508,89 +454,83 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_5sFLc2osnI47JoiweFRLSHIm","type":"function","function":{"name":"bash","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"6GT07ZAnqjs1"} - - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"MvKta6XS7RLFvht"} - - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"command"}}]},"finish_reason":null}],"usage":null,"obfuscation":"a2mM1IHZoTm"} - - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Ep5laICvtUHVR"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_93GtDXN0Kg7YspxC3asmdhYk","type":"function","function":{"name":"bash","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"ySSnjohdk6n1"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"4CjDqiNFV2UFPY4"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" run"}}]},"finish_reason":null}],"usage":null,"obfuscation":"N0ISGBilz0FPmh"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"command"}}]},"finish_reason":null}],"usage":null,"obfuscation":"NY8mPVUSnba"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" /"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"eaTdGisWvQOCY"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"GWxleVMsuaeKCca"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TVl7NT3txV83MAu"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" run"}}]},"finish_reason":null}],"usage":null,"obfuscation":"C9UVNxrgMYtt5O"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"w6f247NLaBmRikc"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" /"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dQpw1ndat5bC4"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8xRdODqpSPqzvVG"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"W2dCHwaflojiX"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"aJXnDKnrDtsTVfx"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Cy8BQSWCn4qpn"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Lg4AxhfLfMAfy3d"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"82ylyQ8EyyJSF"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PgnIQ8JjvP9n5"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6VgpnBCB6ZSNK"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"G72749p5f7Jvq"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"R6x9URVDiINms"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"12OPunMK2z97D"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"orlDX7ytofv4B"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"P"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"M"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/m"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ult"}}]},"finish_reason":null}],"usage":null,"obfuscation":"j96BwjcwBxVQ0xH"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"B"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ied"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yW99kC2wFGqUkzc"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"v"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"it"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/m"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"RfZGxm4odoMEK"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ult"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Law0vyqpoVvCkgC"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"s94JsMcwFQK4U"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ied"}}]},"finish_reason":null}],"usage":null,"obfuscation":"C2ry2nLuFjdC6bW"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"XO3jsNSG5RjeMiN"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"it"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"tVSvtqd9gO14O"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TfMcFis4SYbvW"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"description"}}]},"finish_reason":null}],"usage":null,"obfuscation":"EA4Vrbw"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ez0jIAa3w9ezj"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"RJTY0Xte0PHNh"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3SLRb64CCCoic0G"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Run"}}]},"finish_reason":null}],"usage":null,"obfuscation":"hhTsjOr7qfhM3xl"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"ADk7JTphk4j2x"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" the"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gLOAOwnX2SVogc"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"description"}}]},"finish_reason":null}],"usage":null,"obfuscation":"5zu3FKG"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PHcomUoku2vuAz4"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"B4B1IiCzOAXbh"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" program"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xS3jAOBGrE"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Run"}}]},"finish_reason":null}],"usage":null,"obfuscation":"VvquVGJtD3Soc8o"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" to"}}]},"finish_reason":null}],"usage":null,"obfuscation":"37UtFUYpZMHXfny"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"JK8xG9nhTzLGtRc"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" verify"}}]},"finish_reason":null}],"usage":null,"obfuscation":"uIHuA4QsCZ5"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" program"}}]},"finish_reason":null}],"usage":null,"obfuscation":"FfSpgll5MJ"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" output"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Jb3bKQG6TuX"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" to"}}]},"finish_reason":null}],"usage":null,"obfuscation":"n6zVhLfJzG7TRRG"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" reflects"}}]},"finish_reason":null}],"usage":null,"obfuscation":"JaouWKBjk"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2diEK5qndAGsv"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" edits"}}]},"finish_reason":null}],"usage":null,"obfuscation":"XxGUorClkWr2"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" output"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PbNLCrzC7jk"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Q8BVrEReyhs7RAE"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"WUHcQBrP3p2Nzra"} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVkM25G7Mq2pUwYdZEfdiF0YJdHSx","object":"chat.completion.chunk","created":1761682390,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":10106,"completion_tokens":51,"total_tokens":10157,"prompt_tokens_details":{"cached_tokens":9856,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"qv"} + data: {"id":"chatcmpl-CVxhXchxO08GJjqke7ozg8bnnI7oP","object":"chat.completion.chunk","created":1761733695,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9830,"completion_tokens":48,"total_tokens":9878,"prompt_tokens_details":{"cached_tokens":9600,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"CBvy"} data: [DONE] @@ -599,15 +539,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.369306125s + duration: 2.129170666s - id: 5 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 46068 + content_length: 44642 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_4S7Wdy2QOZEbpwAllfgP2VVA\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_4S7Wdy2QOZEbpwAllfgP2VVA\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_bSThtqcSldXdyvJ5RffRahkA\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_bSThtqcSldXdyvJ5RffRahkA\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_RL2V0zWbfuB7GdSzYwyTI3b4\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\",\\\"edits\\\":[{\\\"old_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\\n}\\\",\\\"new_string\\\":\\\"func main() {\\\\n\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\\n}\\\"},{\\\"old_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\",\\\"new_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\"}]}\",\"name\":\"multiedit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nApplied 2 edits to file: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\n\\n\",\"tool_call_id\":\"call_RL2V0zWbfuB7GdSzYwyTI3b4\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_5sFLc2osnI47JoiweFRLSHIm\",\"function\":{\"arguments\":\"{\\\"command\\\":\\\"go run /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\",\\\"description\\\":\\\"Run the Go program to verify output reflects edits\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Hello, Crush!\\n\\n\\n/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\",\"tool_call_id\":\"call_5sFLc2osnI47JoiweFRLSHIm\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_2kfvT9YLjB55KgVqjOkoY0n9\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_2kfvT9YLjB55KgVqjOkoY0n9\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_hzMBBbJYw5H7ZTrVjS1GHrpw\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_hzMBBbJYw5H7ZTrVjS1GHrpw\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_qP9UOeJX7RQw5rXbYy3RDSJN\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\",\\\"edits\\\":[{\\\"old_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\\n}\\\",\\\"new_string\\\":\\\"func main() {\\\\n\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\\n}\\\"}]}\",\"name\":\"multiedit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nApplied 1 edits to file: /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\n\\n\",\"tool_call_id\":\"call_qP9UOeJX7RQw5rXbYy3RDSJN\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_93GtDXN0Kg7YspxC3asmdhYk\",\"function\":{\"arguments\":\"{\\\"command\\\":\\\"go run /tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool/main.go\\\",\\\"description\\\":\\\"Run Go program to test output\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Hello, Crush!\\n\\n\\n/tmp/crush-test/TestCoderAgent/openai-gpt-5/multiedit_tool\",\"tool_call_id\":\"call_93GtDXN0Kg7YspxC3asmdhYk\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -623,13 +563,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVkM4B6NNUv7GQBVHWHEohp08iL5V","object":"chat.completion.chunk","created":1761682392,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"CudgFdZZyJ"} + data: {"id":"chatcmpl-CVxhaokCzIJtJHIRviSMVKl4mfwZ5","object":"chat.completion.chunk","created":1761733698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"7ksTu0dOAf"} - data: {"id":"chatcmpl-CVkM4B6NNUv7GQBVHWHEohp08iL5V","object":"chat.completion.chunk","created":1761682392,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Done"},"finish_reason":null}],"usage":null,"obfuscation":"EMxho4Bp"} + data: {"id":"chatcmpl-CVxhaokCzIJtJHIRviSMVKl4mfwZ5","object":"chat.completion.chunk","created":1761733698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Done"},"finish_reason":null}],"usage":null,"obfuscation":"I6mYZNXl"} - data: {"id":"chatcmpl-CVkM4B6NNUv7GQBVHWHEohp08iL5V","object":"chat.completion.chunk","created":1761682392,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"tgdH8I"} + data: {"id":"chatcmpl-CVxhaokCzIJtJHIRviSMVKl4mfwZ5","object":"chat.completion.chunk","created":1761733698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"kZT8TE"} - data: {"id":"chatcmpl-CVkM4B6NNUv7GQBVHWHEohp08iL5V","object":"chat.completion.chunk","created":1761682392,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":10195,"completion_tokens":4,"total_tokens":10199,"prompt_tokens_details":{"cached_tokens":10112,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"Hs"} + data: {"id":"chatcmpl-CVxhaokCzIJtJHIRviSMVKl4mfwZ5","object":"chat.completion.chunk","created":1761733698,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9916,"completion_tokens":4,"total_tokens":9920,"prompt_tokens_details":{"cached_tokens":9856,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"C4TPC"} data: [DONE] @@ -638,4 +578,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 4.738843917s + duration: 1.619837291s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/parallel_tool_calls.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/parallel_tool_calls.yaml index df03718c2999eb64a4160248c75eee57c74eb286..814a900955f778ac465fd0bf02b634a3365abb68 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/parallel_tool_calls.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/parallel_tool_calls.yaml @@ -24,25 +24,25 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk73Vs8kMBikpjLb6LZq7WJgTNQ5","object":"chat.completion.chunk","created":1761681461,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"sCMpqOFl4OlDrq"} + data: {"id":"chatcmpl-CVxiYD1I2ZQgpRLtr0xUKkTjo8yEC","object":"chat.completion.chunk","created":1761733758,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"pPAfydXsKPNSnz"} - data: {"id":"chatcmpl-CVk73Vs8kMBikpjLb6LZq7WJgTNQ5","object":"chat.completion.chunk","created":1761681461,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"Parallel"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"pALTTNkP"} + data: {"id":"chatcmpl-CVxiYD1I2ZQgpRLtr0xUKkTjo8yEC","object":"chat.completion.chunk","created":1761733758,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"Parallel"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"I5kwdHz1"} - data: {"id":"chatcmpl-CVk73Vs8kMBikpjLb6LZq7WJgTNQ5","object":"chat.completion.chunk","created":1761681461,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Execution"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"2DBfCv"} + data: {"id":"chatcmpl-CVxiYD1I2ZQgpRLtr0xUKkTjo8yEC","object":"chat.completion.chunk","created":1761733758,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Execution"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"yhJGdB"} - data: {"id":"chatcmpl-CVk73Vs8kMBikpjLb6LZq7WJgTNQ5","object":"chat.completion.chunk","created":1761681461,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" of"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"aOdLfL8zK9LCz"} + data: {"id":"chatcmpl-CVxiYD1I2ZQgpRLtr0xUKkTjo8yEC","object":"chat.completion.chunk","created":1761733758,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" of"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"OCYNUhtxTa5xw"} - data: {"id":"chatcmpl-CVk73Vs8kMBikpjLb6LZq7WJgTNQ5","object":"chat.completion.chunk","created":1761681461,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" glob"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"5NGA2r1yika"} + data: {"id":"chatcmpl-CVxiYD1I2ZQgpRLtr0xUKkTjo8yEC","object":"chat.completion.chunk","created":1761733758,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Glob"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"YNlUPQjUwB5"} - data: {"id":"chatcmpl-CVk73Vs8kMBikpjLb6LZq7WJgTNQ5","object":"chat.completion.chunk","created":1761681461,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" and"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"G2wHvypOUoAF"} + data: {"id":"chatcmpl-CVxiYD1I2ZQgpRLtr0xUKkTjo8yEC","object":"chat.completion.chunk","created":1761733758,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" and"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"s2emJwIDXWjf"} - data: {"id":"chatcmpl-CVk73Vs8kMBikpjLb6LZq7WJgTNQ5","object":"chat.completion.chunk","created":1761681461,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" ls"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"vHzUU9G2Ewg71"} + data: {"id":"chatcmpl-CVxiYD1I2ZQgpRLtr0xUKkTjo8yEC","object":"chat.completion.chunk","created":1761733758,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" LS"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"6oMosjVJaCJHG"} - data: {"id":"chatcmpl-CVk73Vs8kMBikpjLb6LZq7WJgTNQ5","object":"chat.completion.chunk","created":1761681461,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Commands"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"TNbfFAb"} + data: {"id":"chatcmpl-CVxiYD1I2ZQgpRLtr0xUKkTjo8yEC","object":"chat.completion.chunk","created":1761733758,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Commands"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"1GkSlvU"} - data: {"id":"chatcmpl-CVk73Vs8kMBikpjLb6LZq7WJgTNQ5","object":"chat.completion.chunk","created":1761681461,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"HlVRGtbxKq"} + data: {"id":"chatcmpl-CVxiYD1I2ZQgpRLtr0xUKkTjo8yEC","object":"chat.completion.chunk","created":1761733758,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"XgaPRqEY5C"} - data: {"id":"chatcmpl-CVk73Vs8kMBikpjLb6LZq7WJgTNQ5","object":"chat.completion.chunk","created":1761681461,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[],"usage":{"prompt_tokens":154,"completion_tokens":7,"total_tokens":161,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"HOmNZvUQzEpoYw"} + data: {"id":"chatcmpl-CVxiYD1I2ZQgpRLtr0xUKkTjo8yEC","object":"chat.completion.chunk","created":1761733758,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[],"usage":{"prompt_tokens":154,"completion_tokens":7,"total_tokens":161,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"cwWpW77FBYIOim"} data: [DONE] @@ -51,15 +51,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 609.845917ms + duration: 486.920208ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44065 + content_length: 42776 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -75,61 +75,27 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null},"finish_reason":null}],"obfuscation":"6p7sNDO"} + data: {"id":"chatcmpl-CVxiZfZ0lDy2DpSvAzlRCF2cjZSBo","object":"chat.completion.chunk","created":1761733759,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null},"finish_reason":null}],"obfuscation":"5poS3ah"} - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"id":"call_B6Of1mEDDE9cBePrSSnFIfjE","type":"function","function":{"name":"glob","arguments":""}}]},"finish_reason":null}],"obfuscation":"7pgmu7QD1RrQn"} + data: {"id":"chatcmpl-CVxiZfZ0lDy2DpSvAzlRCF2cjZSBo","object":"chat.completion.chunk","created":1761733759,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"id":"call_nTWkd4gIVlQ1qikh14eOOiVt","type":"function","function":{"name":"glob","arguments":""}}]},"finish_reason":null}],"obfuscation":"fzL66CtmwEYZP"} - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\"pa"}}]},"finish_reason":null}],"obfuscation":"KkeHeaZSvmwCj"} + data: {"id":"chatcmpl-CVxiZfZ0lDy2DpSvAzlRCF2cjZSBo","object":"chat.completion.chunk","created":1761733759,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\"pa"}}]},"finish_reason":null}],"obfuscation":"ya7BisZGSp1PN"} - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ttern"}}]},"finish_reason":null}],"obfuscation":"oU1cc0pkvGhHS"} + data: {"id":"chatcmpl-CVxiZfZ0lDy2DpSvAzlRCF2cjZSBo","object":"chat.completion.chunk","created":1761733759,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ttern"}}]},"finish_reason":null}],"obfuscation":"aPpRXUZCPlYYV"} - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\": \"**"}}]},"finish_reason":null}],"obfuscation":"2KfS1rL86U"} + data: {"id":"chatcmpl-CVxiZfZ0lDy2DpSvAzlRCF2cjZSBo","object":"chat.completion.chunk","created":1761733759,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\": \"**"}}]},"finish_reason":null}],"obfuscation":"37gv0JCSUJ"} - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/*.g"}}]},"finish_reason":null}],"obfuscation":"FEuyeizll7cIr5"} + data: {"id":"chatcmpl-CVxiZfZ0lDy2DpSvAzlRCF2cjZSBo","object":"chat.completion.chunk","created":1761733759,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/*.g"}}]},"finish_reason":null}],"obfuscation":"6PolKMUetKk9gA"} - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"o\"}"}}]},"finish_reason":null}],"obfuscation":"I8h0fR0hLQfmfT"} + data: {"id":"chatcmpl-CVxiZfZ0lDy2DpSvAzlRCF2cjZSBo","object":"chat.completion.chunk","created":1761733759,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"o\"}"}}]},"finish_reason":null}],"obfuscation":"6TzBj92jS1838T"} - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"id":"call_zG3iVeHEktHcROOQkA1ROAqo","type":"function","function":{"name":"ls","arguments":""}}]},"finish_reason":null}],"obfuscation":"YeTz3ug7D4pbJDs"} + data: {"id":"chatcmpl-CVxiZfZ0lDy2DpSvAzlRCF2cjZSBo","object":"chat.completion.chunk","created":1761733759,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"id":"call_xL9SnbqyX8xk2L42j3ZFoELh","type":"function","function":{"name":"ls","arguments":""}}]},"finish_reason":null}],"obfuscation":"q9DbbRA4L1uB3xE"} - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"{\"pa"}}]},"finish_reason":null}],"obfuscation":"EPuFmAgj4DEfx"} + data: {"id":"chatcmpl-CVxiZfZ0lDy2DpSvAzlRCF2cjZSBo","object":"chat.completion.chunk","created":1761733759,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"{}"}}]},"finish_reason":null}],"obfuscation":""} - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"th\": "}}]},"finish_reason":null}],"obfuscation":"ai8umqivB3ni"} + data: {"id":"chatcmpl-CVxiZfZ0lDy2DpSvAzlRCF2cjZSBo","object":"chat.completion.chunk","created":1761733759,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"\"/tmp/"}}]},"finish_reason":null}],"obfuscation":"AQ9sMVtBgIu"} - - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"crus"}}]},"finish_reason":null}],"obfuscation":"43XlhyAOoBHLnU"} - - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"h-tes"}}]},"finish_reason":null}],"obfuscation":"CBxVeiFrasrXB"} - - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"t/Test"}}]},"finish_reason":null}],"obfuscation":"xw0LStL72GSQ"} - - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"Code"}}]},"finish_reason":null}],"obfuscation":"g7AshYtLUTbnvU"} - - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"rAgen"}}]},"finish_reason":null}],"obfuscation":"bVKWEczmDYaMM"} - - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"t/open"}}]},"finish_reason":null}],"obfuscation":"AHTeCPZ0b3Is"} - - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"ai-g"}}]},"finish_reason":null}],"obfuscation":"3fcOI06tsuowWc"} - - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"pt-5/"}}]},"finish_reason":null}],"obfuscation":"iQLlWtYBcmNJa"} - - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"parall"}}]},"finish_reason":null}],"obfuscation":"5aVTN3hOEZlb"} - - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"el_t"}}]},"finish_reason":null}],"obfuscation":"XJ7P1qYIpiVRcF"} - - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"ool_c"}}]},"finish_reason":null}],"obfuscation":"EakSoUyP2MN0c"} - - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"alls\","}}]},"finish_reason":null}],"obfuscation":"IP5hOGMMHDT"} - - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":" \"de"}}]},"finish_reason":null}],"obfuscation":"22X99bm65BH4m"} - - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":"pth\":"}}]},"finish_reason":null}],"obfuscation":"Bg9vgj7V1sqm"} - - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"usage":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"function":{"arguments":" 2}"}}]},"finish_reason":null}],"obfuscation":"34IuxRIZQNZ33gC"} - - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - - data: {"id":"chatcmpl-CVk73djpcq5IGPYwy427v6TXlihGB","object":"chat.completion.chunk","created":1761681461,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9757,"completion_tokens":459,"total_tokens":10216,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":384,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":""} + data: {"id":"chatcmpl-CVxiZfZ0lDy2DpSvAzlRCF2cjZSBo","object":"chat.completion.chunk","created":1761733759,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9509,"completion_tokens":308,"total_tokens":9817,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":256,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"Ovbi"} data: [DONE] @@ -138,15 +104,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 14.644243041s + duration: 8.874002s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44734 + content_length: 43354 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_B6Of1mEDDE9cBePrSSnFIfjE\",\"function\":{\"arguments\":\"{\\\"pattern\\\": \\\"**/*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"},{\"id\":\"call_zG3iVeHEktHcROOQkA1ROAqo\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/parallel_tool_calls\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/parallel_tool_calls/main.go\",\"tool_call_id\":\"call_B6Of1mEDDE9cBePrSSnFIfjE\",\"role\":\"tool\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/parallel_tool_calls/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_zG3iVeHEktHcROOQkA1ROAqo\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_nTWkd4gIVlQ1qikh14eOOiVt\",\"function\":{\"arguments\":\"{\\\"pattern\\\": \\\"**/*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"},{\"id\":\"call_xL9SnbqyX8xk2L42j3ZFoELh\",\"function\":{\"arguments\":\"{}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/parallel_tool_calls/main.go\",\"tool_call_id\":\"call_nTWkd4gIVlQ1qikh14eOOiVt\",\"role\":\"tool\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/parallel_tool_calls/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_xL9SnbqyX8xk2L42j3ZFoELh\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -162,49 +128,65 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"oJsA0vr0A1"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"xmVaTora0V"} + + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"SU8t5kBD98d"} + + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" /"},"finish_reason":null}],"usage":null,"obfuscation":"g2IMymbaoJ"} + + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"tmp"},"finish_reason":null}],"usage":null,"obfuscation":"9ZBftYQPa"} + + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/cr"},"finish_reason":null}],"usage":null,"obfuscation":"WT25YATiK"} + + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ush"},"finish_reason":null}],"usage":null,"obfuscation":"b5dtWrIKD"} + + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-test"},"finish_reason":null}],"usage":null,"obfuscation":"By4ay63"} + + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/Test"},"finish_reason":null}],"usage":null,"obfuscation":"O1GsxDL"} + + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Coder"},"finish_reason":null}],"usage":null,"obfuscation":"UYedwU9"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"zfTZL9vz0cx"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Agent"},"finish_reason":null}],"usage":null,"obfuscation":"mtN9PVJ"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" ."},"finish_reason":null}],"usage":null,"obfuscation":"oAC87wBeyc"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/open"},"finish_reason":null}],"usage":null,"obfuscation":"INJ0pfR"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"go"},"finish_reason":null}],"usage":null,"obfuscation":"dmzWzcDWiN"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ai"},"finish_reason":null}],"usage":null,"obfuscation":"hOn1xZNgFE"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":"},"finish_reason":null}],"usage":null,"obfuscation":"vfTM5M25BPo"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-g"},"finish_reason":null}],"usage":null,"obfuscation":"L3t954P7o9"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" main"},"finish_reason":null}],"usage":null,"obfuscation":"13SIu7T"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"pt"},"finish_reason":null}],"usage":null,"obfuscation":"wItKeyY5SH"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"kaD9SjYyB"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"QSaiEK7NdoX"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"\n"},"finish_reason":null}],"usage":null,"obfuscation":"7A4IrJRB7F"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"5"},"finish_reason":null}],"usage":null,"obfuscation":"r0Qwtc7lbX8"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"NPSrCwtgsF5"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"pXuHvwcf991"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" cwd"},"finish_reason":null}],"usage":null,"obfuscation":"TY5t5QkN"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"parallel"},"finish_reason":null}],"usage":null,"obfuscation":"Wcgs"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":\n"},"finish_reason":null}],"usage":null,"obfuscation":"iChjoyOjA"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"_tool"},"finish_reason":null}],"usage":null,"obfuscation":"f9RpEdA"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" "},"finish_reason":null}],"usage":null,"obfuscation":"5vI6jeLNbgi"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"_calls"},"finish_reason":null}],"usage":null,"obfuscation":"0Dkesf"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" -"},"finish_reason":null}],"usage":null,"obfuscation":"2fZGNR0Ps1"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/main"},"finish_reason":null}],"usage":null,"obfuscation":"IFIhV0U"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" go"},"finish_reason":null}],"usage":null,"obfuscation":"1hfdJt92z"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"Sb0I82k7V"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".mod"},"finish_reason":null}],"usage":null,"obfuscation":"8mgLpUs4"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"\n"},"finish_reason":null}],"usage":null,"obfuscation":"yNVUZw0AzC"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"\n"},"finish_reason":null}],"usage":null,"obfuscation":"u0ltFMIjJs"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"go"},"finish_reason":null}],"usage":null,"obfuscation":"MDbbrRcqv4"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" "},"finish_reason":null}],"usage":null,"obfuscation":"RToTu06dubw"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".mod"},"finish_reason":null}],"usage":null,"obfuscation":"TeFwSHRZ"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" -"},"finish_reason":null}],"usage":null,"obfuscation":"4XOcKGc56O"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":","},"finish_reason":null}],"usage":null,"obfuscation":"HGfDwNrry5M"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" main"},"finish_reason":null}],"usage":null,"obfuscation":"bZqqEMQ"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" main"},"finish_reason":null}],"usage":null,"obfuscation":"ThTuZjL"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"Xac5OGr9r"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"OJHQ1hvjJ"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"RlTK4k"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"09Zo8M"} - data: {"id":"chatcmpl-CVk7IwUp3XXvgsDgLStNC9zyab4nc","object":"chat.completion.chunk","created":1761681476,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9895,"completion_tokens":22,"total_tokens":9917,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"zD03"} + data: {"id":"chatcmpl-CVxiiot3GweejEYQBiLqpOc8X3N6I","object":"chat.completion.chunk","created":1761733768,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9624,"completion_tokens":30,"total_tokens":9654,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"GLjs"} data: [DONE] @@ -213,4 +195,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.884039625s + duration: 2.692611791s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/read_a_file.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/read_a_file.yaml index deb331bc17f4a8ce852a599c60f739367a57bdff..a887885555021d35f6daad8c21353217dd6e5ac6 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/read_a_file.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/read_a_file.yaml @@ -24,19 +24,21 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk2fOChi0EXvda7Rntuv9XiBcRfo","object":"chat.completion.chunk","created":1761681189,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"XJINLSJVcEqfn3"} + data: {"id":"chatcmpl-CVxfsqyhMAnXQCedYjL0jY0sLpsr6","object":"chat.completion.chunk","created":1761733592,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"VK2BAijwTlajVd"} - data: {"id":"chatcmpl-CVk2fOChi0EXvda7Rntuv9XiBcRfo","object":"chat.completion.chunk","created":1761681189,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"Understanding"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"k1m"} + data: {"id":"chatcmpl-CVxfsqyhMAnXQCedYjL0jY0sLpsr6","object":"chat.completion.chunk","created":1761733592,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"Understanding"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"qOm"} - data: {"id":"chatcmpl-CVk2fOChi0EXvda7Rntuv9XiBcRfo","object":"chat.completion.chunk","created":1761681189,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"r6OLbFohCF8IU"} + data: {"id":"chatcmpl-CVxfsqyhMAnXQCedYjL0jY0sLpsr6","object":"chat.completion.chunk","created":1761733592,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" the"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"5vPcqD6EIohJ"} - data: {"id":"chatcmpl-CVk2fOChi0EXvda7Rntuv9XiBcRfo","object":"chat.completion.chunk","created":1761681189,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Mod"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"PsQ8FROv9Y6l"} + data: {"id":"chatcmpl-CVxfsqyhMAnXQCedYjL0jY0sLpsr6","object":"chat.completion.chunk","created":1761733592,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"iXF5gAJ7XhejP"} - data: {"id":"chatcmpl-CVk2fOChi0EXvda7Rntuv9XiBcRfo","object":"chat.completion.chunk","created":1761681189,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Files"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"0bUVP3bdbz"} + data: {"id":"chatcmpl-CVxfsqyhMAnXQCedYjL0jY0sLpsr6","object":"chat.completion.chunk","created":1761733592,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Module"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"vMjD37sXi"} - data: {"id":"chatcmpl-CVk2fOChi0EXvda7Rntuv9XiBcRfo","object":"chat.completion.chunk","created":1761681189,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"zeXPNl5qS6"} + data: {"id":"chatcmpl-CVxfsqyhMAnXQCedYjL0jY0sLpsr6","object":"chat.completion.chunk","created":1761733592,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" File"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"XzSQUAtgDX5"} - data: {"id":"chatcmpl-CVk2fOChi0EXvda7Rntuv9XiBcRfo","object":"chat.completion.chunk","created":1761681189,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[],"usage":{"prompt_tokens":129,"completion_tokens":4,"total_tokens":133,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"nAPl04jqBnXWZG"} + data: {"id":"chatcmpl-CVxfsqyhMAnXQCedYjL0jY0sLpsr6","object":"chat.completion.chunk","created":1761733592,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"VtQgyQkkRQ"} + + data: {"id":"chatcmpl-CVxfsqyhMAnXQCedYjL0jY0sLpsr6","object":"chat.completion.chunk","created":1761733592,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[],"usage":{"prompt_tokens":129,"completion_tokens":5,"total_tokens":134,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"0GYhPD0vZ1pavO"} data: [DONE] @@ -45,15 +47,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.271404792s + duration: 1.309171083s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 43938 + content_length: 42649 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -69,61 +71,65 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_OVcYjBkAhyuJnm3HTXw15Fg8","type":"function","function":{"name":"ls","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"ymeDkGwEDZHhOz"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_aisx5buOifNvNrcHEZjT36jt","type":"function","function":{"name":"ls","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"iN6ziAF5Ms1X7J"} + + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"4lyStB0TVJ59zIa"} + + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3dBPEbH2pBbTVF"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"iSSoyeIrqo44qeg"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"GrFSjPpBrZV3oZf"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0aPWLlxwbQPzi9"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"EigLR4ieIhVNBi"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"aPbSjVCfm3sWuAU"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vTB1HPH7q8jwuDX"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kCeYuFUxJtbWhuS"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"D1Og4aTC8lX5zFV"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0oevWl7uOtSQoH6"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"O2Tl07emWgB226Q"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"R8geVH9oV3qUZx2"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"sFXlgPALvTwv5"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"EAmUYJ310sFbWQR"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TlcjoDJ3rfjuY"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"d6WeEu4vIil5V"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xHh4QdKulogGE"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"VfLvtYGGGMFCG"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"FP0c4wmVk4Foy"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"zhDKLOAFWZgQB"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"hA9Wjl9G0xSwW"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"GLV2A1biYzjZY"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"GZmThkyigzTaU"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"H"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"e"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"J"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/read"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6Y7rIJJueRyG6"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"t"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/read"}}]},"finish_reason":null}],"usage":null,"obfuscation":"WOvwToqsU8dX8"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9lUe0LIaIk3jm"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\","}}]},"finish_reason":null}],"usage":null,"obfuscation":"3JTsrXt4CqSt6bT"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"SXSlswLVIDhLH"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \""}}]},"finish_reason":null}],"usage":null,"obfuscation":"1tuBS8VoNiLfCwV"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"LBknTi5BR3vIr"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"depth"}}]},"finish_reason":null}],"usage":null,"obfuscation":"OXiU9eaEQipxJ"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"depth"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vwDUXIuJhYGBM"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"VSnKhYABQCBYCPS"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7tbjJbZ1sz5rRAf"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" "}}]},"finish_reason":null}],"usage":null,"obfuscation":"p"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"2"}}]},"finish_reason":null}],"usage":null,"obfuscation":"z"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"2"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Z"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"y"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Q"} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2ghrTFlpNvfONSsFAocAqbwlo7","object":"chat.completion.chunk","created":1761681190,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9731,"completion_tokens":171,"total_tokens":9902,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":128,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"11es"} + data: {"id":"chatcmpl-CVxfshUCLBpl8gM23njNijETK3VcC","object":"chat.completion.chunk","created":1761733592,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9483,"completion_tokens":109,"total_tokens":9592,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":64,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"xyyKC"} data: [DONE] @@ -132,15 +138,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 7.035277167s + duration: 5.358237292s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44316 + content_length: 43030 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_OVcYjBkAhyuJnm3HTXw15Fg8\",\"function\":{\"arguments\":\"{\\\"path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file\\\",\\\"depth\\\":2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_OVcYjBkAhyuJnm3HTXw15Fg8\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_aisx5buOifNvNrcHEZjT36jt\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_aisx5buOifNvNrcHEZjT36jt\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -156,59 +162,59 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_kzOawKCjjknJkBZOjsCG12FV","type":"function","function":{"name":"view","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"nDWG1sBSLoRx"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_BWp5Ebu16fM911slVJPImirp","type":"function","function":{"name":"view","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"0qy0nZN2fwmY"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"AJbOg7XdUZ97Hww"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"qwnhHSa8Qu86bGx"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4Toqdmbkh1MevA"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"uFAKijDM9vxvwF"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Rk1aZf5kyScto"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"RXh10hDx9E8Qa"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3pX61wzv5rcTtjt"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1tNZxkADbkEeSxO"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"U3DinAbzliitFoY"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3J5ubnioZa3Nq9Z"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"pmdgI5M024asQsf"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vQYALtAN0bK8JJ1"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"MZFgnypBnURlyzp"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ZFWrlQgWfhUnQq3"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"R3RuQR6kuxFVBaJ"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xWZCRjbSGwmBgkN"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"g8tRivck6xV4k"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"XUsWKdxNqYcz7"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2Sf1FSWV5hpyK"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"sWmLmrd10V9cn"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"k8dOtWB2iUyjW"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dkDnrZElQV1YQ"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"aJRgG0KXeW4z6"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"SRiK6a4DMA2Bu"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6dN9ImChoul3l"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Ws6ux2eS9qmTY"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"A"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"H"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/read"}}]},"finish_reason":null}],"usage":null,"obfuscation":"wi3tLRm0CQWqI"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/read"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ShEF41fsg2izL"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1rn48MdV71HcB"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"C53kL7PPVZDtw"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"QrAKNTl1CDZsfxJ"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"KVLlKviMcsbE8yK"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".mod"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Rjez1xipSzWVPs"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".mod"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kolIjGLD4gbrmu"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"WZmVeKqF8b0Jkfn"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"YINaVvBX6QDdC1D"} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2nejxZl171WPOJ13x51BFdWRg2","object":"chat.completion.chunk","created":1761681197,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9808,"completion_tokens":35,"total_tokens":9843,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"s4lD"} + data: {"id":"chatcmpl-CVxfy9A8icxVsI27XGCxfyF6fjjfz","object":"chat.completion.chunk","created":1761733598,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9560,"completion_tokens":35,"total_tokens":9595,"prompt_tokens_details":{"cached_tokens":8832,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"gYLD"} data: [DONE] @@ -217,15 +223,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.654104083s + duration: 2.475422208s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44690 + content_length: 43404 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_OVcYjBkAhyuJnm3HTXw15Fg8\",\"function\":{\"arguments\":\"{\\\"path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file\\\",\\\"depth\\\":2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_OVcYjBkAhyuJnm3HTXw15Fg8\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_kzOawKCjjknJkBZOjsCG12FV\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file/go.mod\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"call_kzOawKCjjknJkBZOjsCG12FV\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_aisx5buOifNvNrcHEZjT36jt\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_aisx5buOifNvNrcHEZjT36jt\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_BWp5Ebu16fM911slVJPImirp\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/read_a_file/go.mod\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"call_BWp5Ebu16fM911slVJPImirp\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -241,33 +247,33 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk2qlIckw9IJgrdbXF46n0tJrkIZ","object":"chat.completion.chunk","created":1761681200,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"sPlX0WFcRi"} + data: {"id":"chatcmpl-CVxg034RGfcJs1oEi70cishY7L14U","object":"chat.completion.chunk","created":1761733600,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"m5rqMVS7ie"} - data: {"id":"chatcmpl-CVk2qlIckw9IJgrdbXF46n0tJrkIZ","object":"chat.completion.chunk","created":1761681200,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"module"},"finish_reason":null}],"usage":null,"obfuscation":"uE5toU"} + data: {"id":"chatcmpl-CVxg034RGfcJs1oEi70cishY7L14U","object":"chat.completion.chunk","created":1761733600,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"module"},"finish_reason":null}],"usage":null,"obfuscation":"LsZbMy"} - data: {"id":"chatcmpl-CVk2qlIckw9IJgrdbXF46n0tJrkIZ","object":"chat.completion.chunk","created":1761681200,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" example"},"finish_reason":null}],"usage":null,"obfuscation":"bPUw"} + data: {"id":"chatcmpl-CVxg034RGfcJs1oEi70cishY7L14U","object":"chat.completion.chunk","created":1761733600,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" example"},"finish_reason":null}],"usage":null,"obfuscation":"TDt3"} - data: {"id":"chatcmpl-CVk2qlIckw9IJgrdbXF46n0tJrkIZ","object":"chat.completion.chunk","created":1761681200,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".com"},"finish_reason":null}],"usage":null,"obfuscation":"3qdbs34u"} + data: {"id":"chatcmpl-CVxg034RGfcJs1oEi70cishY7L14U","object":"chat.completion.chunk","created":1761733600,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".com"},"finish_reason":null}],"usage":null,"obfuscation":"10LVQNzK"} - data: {"id":"chatcmpl-CVk2qlIckw9IJgrdbXF46n0tJrkIZ","object":"chat.completion.chunk","created":1761681200,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/test"},"finish_reason":null}],"usage":null,"obfuscation":"MTs3cQq"} + data: {"id":"chatcmpl-CVxg034RGfcJs1oEi70cishY7L14U","object":"chat.completion.chunk","created":1761733600,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/test"},"finish_reason":null}],"usage":null,"obfuscation":"ycPhcwc"} - data: {"id":"chatcmpl-CVk2qlIckw9IJgrdbXF46n0tJrkIZ","object":"chat.completion.chunk","created":1761681200,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"project"},"finish_reason":null}],"usage":null,"obfuscation":"wVrqI"} + data: {"id":"chatcmpl-CVxg034RGfcJs1oEi70cishY7L14U","object":"chat.completion.chunk","created":1761733600,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"project"},"finish_reason":null}],"usage":null,"obfuscation":"LIPJ5"} - data: {"id":"chatcmpl-CVk2qlIckw9IJgrdbXF46n0tJrkIZ","object":"chat.completion.chunk","created":1761681200,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"\n"},"finish_reason":null}],"usage":null,"obfuscation":"sXohoTsT04"} + data: {"id":"chatcmpl-CVxg034RGfcJs1oEi70cishY7L14U","object":"chat.completion.chunk","created":1761733600,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"\n"},"finish_reason":null}],"usage":null,"obfuscation":"j17uj5Haci"} - data: {"id":"chatcmpl-CVk2qlIckw9IJgrdbXF46n0tJrkIZ","object":"chat.completion.chunk","created":1761681200,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"go"},"finish_reason":null}],"usage":null,"obfuscation":"lHcPb1ze3o"} + data: {"id":"chatcmpl-CVxg034RGfcJs1oEi70cishY7L14U","object":"chat.completion.chunk","created":1761733600,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"go"},"finish_reason":null}],"usage":null,"obfuscation":"8G89wEm2lR"} - data: {"id":"chatcmpl-CVk2qlIckw9IJgrdbXF46n0tJrkIZ","object":"chat.completion.chunk","created":1761681200,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" "},"finish_reason":null}],"usage":null,"obfuscation":"ETK5Bsd4dvM"} + data: {"id":"chatcmpl-CVxg034RGfcJs1oEi70cishY7L14U","object":"chat.completion.chunk","created":1761733600,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" "},"finish_reason":null}],"usage":null,"obfuscation":"S5SZXpbHu6L"} - data: {"id":"chatcmpl-CVk2qlIckw9IJgrdbXF46n0tJrkIZ","object":"chat.completion.chunk","created":1761681200,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"1"},"finish_reason":null}],"usage":null,"obfuscation":"xYNYbNi5TSi"} + data: {"id":"chatcmpl-CVxg034RGfcJs1oEi70cishY7L14U","object":"chat.completion.chunk","created":1761733600,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"1"},"finish_reason":null}],"usage":null,"obfuscation":"j8Zl9WgT5kJ"} - data: {"id":"chatcmpl-CVk2qlIckw9IJgrdbXF46n0tJrkIZ","object":"chat.completion.chunk","created":1761681200,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"finish_reason":null}],"usage":null,"obfuscation":"I1dmzfMlP0c"} + data: {"id":"chatcmpl-CVxg034RGfcJs1oEi70cishY7L14U","object":"chat.completion.chunk","created":1761733600,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"finish_reason":null}],"usage":null,"obfuscation":"RgEscIb1WL9"} - data: {"id":"chatcmpl-CVk2qlIckw9IJgrdbXF46n0tJrkIZ","object":"chat.completion.chunk","created":1761681200,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"23"},"finish_reason":null}],"usage":null,"obfuscation":"HQhrCSE8DR"} + data: {"id":"chatcmpl-CVxg034RGfcJs1oEi70cishY7L14U","object":"chat.completion.chunk","created":1761733600,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"23"},"finish_reason":null}],"usage":null,"obfuscation":"u8YfGg8dJ4"} - data: {"id":"chatcmpl-CVk2qlIckw9IJgrdbXF46n0tJrkIZ","object":"chat.completion.chunk","created":1761681200,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"XXGsr6"} + data: {"id":"chatcmpl-CVxg034RGfcJs1oEi70cishY7L14U","object":"chat.completion.chunk","created":1761733600,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"C1o7Ol"} - data: {"id":"chatcmpl-CVk2qlIckw9IJgrdbXF46n0tJrkIZ","object":"chat.completion.chunk","created":1761681200,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9883,"completion_tokens":14,"total_tokens":9897,"prompt_tokens_details":{"cached_tokens":9728,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"YVzo"} + data: {"id":"chatcmpl-CVxg034RGfcJs1oEi70cishY7L14U","object":"chat.completion.chunk","created":1761733600,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9635,"completion_tokens":14,"total_tokens":9649,"prompt_tokens_details":{"cached_tokens":9472,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"qA4p"} data: [DONE] @@ -276,4 +282,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 3.558921s + duration: 1.54721475s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/simple_test.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/simple_test.yaml index 8db146421b770c68c0d439aa43adb0bef0fbc9e3..f248e2ee18b5cd5c9b8b13a629a463001ee2e528 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/simple_test.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/simple_test.yaml @@ -24,13 +24,21 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk2beojsDVmmqhq9e3IepwKOIfY6","object":"chat.completion.chunk","created":1761681185,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"uGjyEb2R4SzsZu"} + data: {"id":"chatcmpl-CVxfoZB6zcGc1VZrZUzSamYIAWNXh","object":"chat.completion.chunk","created":1761733588,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"aMsC5a8SLmugEm"} - data: {"id":"chatcmpl-CVk2beojsDVmmqhq9e3IepwKOIfY6","object":"chat.completion.chunk","created":1761681185,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"Greeting"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ic6Z4RhP"} + data: {"id":"chatcmpl-CVxfoZB6zcGc1VZrZUzSamYIAWNXh","object":"chat.completion.chunk","created":1761733588,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"User"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"LOYyNuNKwOaU"} - data: {"id":"chatcmpl-CVk2beojsDVmmqhq9e3IepwKOIfY6","object":"chat.completion.chunk","created":1761681185,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"Hu41ilGFmi"} + data: {"id":"chatcmpl-CVxfoZB6zcGc1VZrZUzSamYIAWNXh","object":"chat.completion.chunk","created":1761733588,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" gre"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"mCBrKVx5IO1a"} - data: {"id":"chatcmpl-CVk2beojsDVmmqhq9e3IepwKOIfY6","object":"chat.completion.chunk","created":1761681185,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[],"usage":{"prompt_tokens":126,"completion_tokens":1,"total_tokens":127,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"IROPExM99CDjTU"} + data: {"id":"chatcmpl-CVxfoZB6zcGc1VZrZUzSamYIAWNXh","object":"chat.completion.chunk","created":1761733588,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"ets"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"pHwmDStNNLMhM"} + + data: {"id":"chatcmpl-CVxfoZB6zcGc1VZrZUzSamYIAWNXh","object":"chat.completion.chunk","created":1761733588,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" the"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"sbZTyOCJuiwY"} + + data: {"id":"chatcmpl-CVxfoZB6zcGc1VZrZUzSamYIAWNXh","object":"chat.completion.chunk","created":1761733588,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" assistant"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"f4h3Jb"} + + data: {"id":"chatcmpl-CVxfoZB6zcGc1VZrZUzSamYIAWNXh","object":"chat.completion.chunk","created":1761733588,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"w8CJ3UFu8C"} + + data: {"id":"chatcmpl-CVxfoZB6zcGc1VZrZUzSamYIAWNXh","object":"chat.completion.chunk","created":1761733588,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[],"usage":{"prompt_tokens":126,"completion_tokens":5,"total_tokens":131,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"CEbJX40DtPTTCY"} data: [DONE] @@ -39,15 +47,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.698654583s + duration: 1.06631825s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 43928 + content_length: 42639 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/simple_test\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Hello\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/simple_test\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Hello\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -63,13 +71,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk2bMTYKgDjk47HEd1JzSD4LeApH","object":"chat.completion.chunk","created":1761681185,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"9oT9bsQbAP"} + data: {"id":"chatcmpl-CVxfpTwrcHzg9CVeTJXNaDh3AEC0U","object":"chat.completion.chunk","created":1761733589,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"XiifzSy3Zx"} - data: {"id":"chatcmpl-CVk2bMTYKgDjk47HEd1JzSD4LeApH","object":"chat.completion.chunk","created":1761681185,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Hi"},"finish_reason":null}],"usage":null,"obfuscation":"JC2aagrPM1"} + data: {"id":"chatcmpl-CVxfpTwrcHzg9CVeTJXNaDh3AEC0U","object":"chat.completion.chunk","created":1761733589,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Hi"},"finish_reason":null}],"usage":null,"obfuscation":"wI28msJhka"} - data: {"id":"chatcmpl-CVk2bMTYKgDjk47HEd1JzSD4LeApH","object":"chat.completion.chunk","created":1761681185,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"dDs0wI"} + data: {"id":"chatcmpl-CVxfpTwrcHzg9CVeTJXNaDh3AEC0U","object":"chat.completion.chunk","created":1761733589,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"iToHqf"} - data: {"id":"chatcmpl-CVk2bMTYKgDjk47HEd1JzSD4LeApH","object":"chat.completion.chunk","created":1761681185,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9727,"completion_tokens":74,"total_tokens":9801,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":64,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"CyqynO"} + data: {"id":"chatcmpl-CVxfpTwrcHzg9CVeTJXNaDh3AEC0U","object":"chat.completion.chunk","created":1761733589,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9479,"completion_tokens":74,"total_tokens":9553,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":64,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"tTQ5Cj"} data: [DONE] @@ -78,4 +86,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 4.593622375s + duration: 3.8844445s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/sourcegraph_tool.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/sourcegraph_tool.yaml index 5e4064eb88745deff9ccaa24cc3f1a0e792ede8a..eb3df56ec2223cca6847acad8dfa4a2b5abd9075 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/sourcegraph_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/sourcegraph_tool.yaml @@ -24,35 +24,35 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk6bQPgmH7NADAN4APH859zh8m9o","object":"chat.completion.chunk","created":1761681433,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"3efVtikOwU2QQd"} + data: {"id":"chatcmpl-CVxhb9XpRntdr2SCeaKyYgPZD2Yzo","object":"chat.completion.chunk","created":1761733699,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"nyQRnfPR5mNFuX"} - data: {"id":"chatcmpl-CVk6bQPgmH7NADAN4APH859zh8m9o","object":"chat.completion.chunk","created":1761681433,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"Searching"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"5iDhw3i"} + data: {"id":"chatcmpl-CVxhb9XpRntdr2SCeaKyYgPZD2Yzo","object":"chat.completion.chunk","created":1761733699,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"Searching"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"5Z1lXvc"} - data: {"id":"chatcmpl-CVk6bQPgmH7NADAN4APH859zh8m9o","object":"chat.completion.chunk","created":1761681433,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" '"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"6v41Y1YsuWpWsS"} + data: {"id":"chatcmpl-CVxhb9XpRntdr2SCeaKyYgPZD2Yzo","object":"chat.completion.chunk","created":1761733699,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" '"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"K7mRbp9xJHNKSj"} - data: {"id":"chatcmpl-CVk6bQPgmH7NADAN4APH859zh8m9o","object":"chat.completion.chunk","created":1761681433,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"func"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"BS6Pr9k4ipaE"} + data: {"id":"chatcmpl-CVxhb9XpRntdr2SCeaKyYgPZD2Yzo","object":"chat.completion.chunk","created":1761733699,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"func"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"fN4z6f7wpdU7"} - data: {"id":"chatcmpl-CVk6bQPgmH7NADAN4APH859zh8m9o","object":"chat.completion.chunk","created":1761681433,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" main"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"cmn25X4mcO9"} + data: {"id":"chatcmpl-CVxhb9XpRntdr2SCeaKyYgPZD2Yzo","object":"chat.completion.chunk","created":1761733699,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" main"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"xxdpmMec5mM"} - data: {"id":"chatcmpl-CVk6bQPgmH7NADAN4APH859zh8m9o","object":"chat.completion.chunk","created":1761681433,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"'"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ogbWLN6TSPcHI7T"} + data: {"id":"chatcmpl-CVxhb9XpRntdr2SCeaKyYgPZD2Yzo","object":"chat.completion.chunk","created":1761733699,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"'"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"VPigHmppyEiAzMM"} - data: {"id":"chatcmpl-CVk6bQPgmH7NADAN4APH859zh8m9o","object":"chat.completion.chunk","created":1761681433,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"7m5n01mGx17jK"} + data: {"id":"chatcmpl-CVxhb9XpRntdr2SCeaKyYgPZD2Yzo","object":"chat.completion.chunk","created":1761733699,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" in"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"dNn1aDIPvyjgv"} - data: {"id":"chatcmpl-CVk6bQPgmH7NADAN4APH859zh8m9o","object":"chat.completion.chunk","created":1761681433,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ZCFYmNUoMmKVL"} + data: {"id":"chatcmpl-CVxhb9XpRntdr2SCeaKyYgPZD2Yzo","object":"chat.completion.chunk","created":1761733699,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"UMLOIcnJjGBOe"} - data: {"id":"chatcmpl-CVk6bQPgmH7NADAN4APH859zh8m9o","object":"chat.completion.chunk","created":1761681433,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Re"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ooRjlcuX3j2iJ"} + data: {"id":"chatcmpl-CVxhb9XpRntdr2SCeaKyYgPZD2Yzo","object":"chat.completion.chunk","created":1761733699,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Re"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"LHBc4UtQDuB1J"} - data: {"id":"chatcmpl-CVk6bQPgmH7NADAN4APH859zh8m9o","object":"chat.completion.chunk","created":1761681433,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"positories"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"FRh6cT"} + data: {"id":"chatcmpl-CVxhb9XpRntdr2SCeaKyYgPZD2Yzo","object":"chat.completion.chunk","created":1761733699,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"positories"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"tBFMl7"} - data: {"id":"chatcmpl-CVk6bQPgmH7NADAN4APH859zh8m9o","object":"chat.completion.chunk","created":1761681433,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" with"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"fCDPFRLW1TB"} + data: {"id":"chatcmpl-CVxhb9XpRntdr2SCeaKyYgPZD2Yzo","object":"chat.completion.chunk","created":1761733699,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" with"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"YoyEXpzCbxj"} - data: {"id":"chatcmpl-CVk6bQPgmH7NADAN4APH859zh8m9o","object":"chat.completion.chunk","created":1761681433,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Source"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"cdHXGCsGB"} + data: {"id":"chatcmpl-CVxhb9XpRntdr2SCeaKyYgPZD2Yzo","object":"chat.completion.chunk","created":1761733699,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Source"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"oRUMilyWc"} - data: {"id":"chatcmpl-CVk6bQPgmH7NADAN4APH859zh8m9o","object":"chat.completion.chunk","created":1761681433,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"graph"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"aV5ylGH1wqM"} + data: {"id":"chatcmpl-CVxhb9XpRntdr2SCeaKyYgPZD2Yzo","object":"chat.completion.chunk","created":1761733699,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"graph"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"vsCbW6B8FR7"} - data: {"id":"chatcmpl-CVk6bQPgmH7NADAN4APH859zh8m9o","object":"chat.completion.chunk","created":1761681433,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"euwy79pPSc"} + data: {"id":"chatcmpl-CVxhb9XpRntdr2SCeaKyYgPZD2Yzo","object":"chat.completion.chunk","created":1761733699,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"01xlhXGDvI"} - data: {"id":"chatcmpl-CVk6bQPgmH7NADAN4APH859zh8m9o","object":"chat.completion.chunk","created":1761681433,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[],"usage":{"prompt_tokens":138,"completion_tokens":12,"total_tokens":150,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"UwyCkvyEEF1dk"} + data: {"id":"chatcmpl-CVxhb9XpRntdr2SCeaKyYgPZD2Yzo","object":"chat.completion.chunk","created":1761733699,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[],"usage":{"prompt_tokens":138,"completion_tokens":12,"total_tokens":150,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"MSJHp2mgtD0CD"} data: [DONE] @@ -61,15 +61,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 736.569917ms + duration: 613.245583ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 43988 + content_length: 42699 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -85,61 +85,93 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_WgfXGWFY5hBNcKY4ZHs5U2Cs","type":"function","function":{"name":"sourcegraph","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"EZCs0"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_aJVDFP0W6iLFKxt3YI1ufrYh","type":"function","function":{"name":"sourcegraph","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"Cy2ry"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"bkwAndNmbCLesaJ"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"vgT4V3uj42uNlrO"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"query"}}]},"finish_reason":null}],"usage":null,"obfuscation":"FziGWKBeyqNkO"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"query"}}]},"finish_reason":null}],"usage":null,"obfuscation":"WuKq4PQNF6eJF"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"7H7o14i45yuTx"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"2A79D0Sacq4h0"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"lang"}}]},"finish_reason":null}],"usage":null,"obfuscation":"It3kmoFvOoYNy8"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"lang"}}]},"finish_reason":null}],"usage":null,"obfuscation":"rHgNTJVyjT5wMn"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Z"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"s6SmFzf4r9SPl"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"NzvjTqXoEb4gF"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"func"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0tSV4T5RD0tZlD"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":\\\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ATMuyeY31bWgN"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"nMsjgVhAHfQOU"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"."}}]},"finish_reason":null}],"usage":null,"obfuscation":"p"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"dCYIht4UuDc6w"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" select"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Em6ax4Ro54L"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"$"}}]},"finish_reason":null}],"usage":null,"obfuscation":"C"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"sphlNp1wHVqJH"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" content"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Rm6cZKal4P"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" count"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1Zk9oCuASD8u"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Kc0w5hLxUjX28"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"func"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7OB2RpK2rI0wO4"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"20"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"n1nR0HakJ1yN1"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Gjar5wmMUnPFn"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Nue1q8L3jZbGU"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"count"}}]},"finish_reason":null}],"usage":null,"obfuscation":"eCKFqYNECfc0W"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" -"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"zjgNpSG7edygqKL"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1WHhNnrPPfONND"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"20"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qyJtClODSVo7y"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"iRakKaog5RC58Mi"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" -"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"context"}}]},"finish_reason":null}],"usage":null,"obfuscation":"oYEQOTPANJC"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dufIFgle5411e4"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_window"}}]},"finish_reason":null}],"usage":null,"obfuscation":"JgWhOsH42pk"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":_"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9TbSQIE8WLd3qBl"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"UNoFko4GXBTixi"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"8"}}]},"finish_reason":null}],"usage":null,"obfuscation":"k"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"eqj2WkxDH65jd7U"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"I"} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" count"}}]},"finish_reason":null}],"usage":null,"obfuscation":"53rC4RF56WJa"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"K"} - data: {"id":"chatcmpl-CVk6bHSYd1NXSEkIeoIo2HbYwfKxU","object":"chat.completion.chunk","created":1761681433,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9740,"completion_tokens":299,"total_tokens":10039,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":256,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":""} + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"10"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"oqNkZR3yzb5NQ"} + + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"count"}}]},"finish_reason":null}],"usage":null,"obfuscation":"51xwmmvq1uzCE"} + + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"baoePVzbmypw1dB"} + + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"10"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"s0lRWW9yQiMg3ik"} + + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"context"}}]},"finish_reason":null}],"usage":null,"obfuscation":"NbwraE5osS1"} + + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_window"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xQMMwb1w22W"} + + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"MOpP05H4fuDXsoA"} + + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"H"} + + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"LZTpb1VUhWaf8mV"} + + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"timeout"}}]},"finish_reason":null}],"usage":null,"obfuscation":"FnLP0uDpFVU"} + + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"WdfI3mQbFBY9PY2"} + + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"60"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"o"} + + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CVxhc8P00hi9v7nyu9VmMqekZE0ao","object":"chat.completion.chunk","created":1761733700,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9492,"completion_tokens":251,"total_tokens":9743,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":192,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"q"} data: [DONE] @@ -148,15 +180,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 8.98533525s + duration: 6.529730416s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 450 + content_length: 484 host: sourcegraph.com - body: '{"query":"query Search($query: String!) { search(query: $query, version: V2, patternType: keyword ) { results { matchCount, limitHit, resultCount, approximateResultCount, missing { name }, timedout { name }, indexUnavailable, results { __typename, ... on FileMatch { repository { name }, file { path, url, content }, lineMatches { preview, lineNumber, offsetAndLengths } } } } } }","variables":{"query":"lang:go \"func main(\" select:file count:20"}}' + body: '{"query":"query Search($query: String!) { search(query: $query, version: V2, patternType: keyword ) { results { matchCount, limitHit, resultCount, approximateResultCount, missing { name }, timedout { name }, indexUnavailable, results { __typename, ... on FileMatch { repository { name }, file { path, url, content }, lineMatches { preview, lineNumber, offsetAndLengths } } } } } }","variables":{"query":"lang:go file:\\.go$ content:\"func main(\" -file:test -file:_test.go count:10"}}' headers: Content-Type: - application/json @@ -170,21 +202,21 @@ interactions: proto_minor: 0 content_length: -1 uncompressed: true - body: '{"data":{"search":{"results":{"matchCount":20,"limitHit":true,"resultCount":20,"approximateResultCount":"20+","missing":[],"timedout":[],"indexUnavailable":false,"results":[{"__typename":"FileMatch","repository":{"name":"github.com/yunabe/lgo"},"file":{"path":"cmd/lgo-internal/liner/liner_test.go","url":"/github.com/yunabe/lgo/-/blob/cmd/lgo-internal/liner/liner_test.go","content":"package liner\n\nimport (\n\t\"testing\"\n)\n\nfunc TestContinueLine(t *testing.T) {\n\ttests := []struct {\n\t\tlines []string\n\t\texpect bool\n\t\tindent int\n\t}{{\n\t\tlines: []string{\"x +\"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\" y +\"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"func\"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\" func\"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"if\"},\n\t\texpect: true,\n\t}, {\n\t\t// syntax error.\n\t\tlines: []string{\"if {\"},\n\t\texpect: false,\n\t}, {\n\t\tlines: []string{\"for {\"},\n\t\texpect: true,\n\t\tindent: 1,\n\t}, {\n\t\tlines: []string{\"for{for{for{{\"},\n\t\texpect: true,\n\t\tindent: 4,\n\t}, {\n\t\tlines: []string{\"for{for{for{{}\"},\n\t\texpect: true,\n\t\tindent: 3,\n\t}, {\n\t\tlines: []string{\"func main()\"},\n\t\t// This is false because `func f()\u003cnewline\u003e{}` is invalid in Go`\n\t\texpect: false,\n\t}, {\n\t\t// Don''t return true even if \"missing function body\" occurrs.\n\t\tlines: []string{\"func main()\", \"func main2(){}\"},\n\t\texpect: false,\n\t}, {\n\t\tlines: []string{\"import fmt\"},\n\t\t// This must be true because `import fmt\u003cnewline\u003e\"fmt\"` is invalid.\n\t\t// TODO: Fix this\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"func main(\"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"func main(x,\"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"func main(x\"},\n\t\t// Strickly speaking, this should be false if there is no possible valid statement with this.\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"func (\"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"func (r interface{\"},\n\t\texpect: true,\n\t\tindent: 1,\n\t}, {\n\t\tlines: []string{\"/* comment \"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"`raw string\"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"for {\", \"for {\"},\n\t\texpect: true,\n\t\tindent: 2,\n\t}, {\n\t\tlines: []string{\"for {\", \" \"},\n\t\texpect: true,\n\t\tindent: 1,\n\t}, {\n\t\tlines: []string{\"for {\", \"\\t\"},\n\t\texpect: true,\n\t\tindent: 1,\n\t}, {\n\t\t// This tests dropEmptyLine.\n\t\tlines: []string{\"for {\", \"\"},\n\t\texpect: true,\n\t\tindent: 1,\n\t}, {\n\t\tlines: []string{\"type s struct {}\"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"type s struct {}\", \"\"},\n\t\texpect: false,\n\t}, {\n\t\tlines: []string{\"type s struct {}\", \" \"},\n\t\texpect: false,\n\t}, {\n\t\tlines: []string{\"func (s) f(){}\"},\n\t\texpect: true,\n\t}, {\n\t\tlines: []string{\"func (s) f(){}\", \"\"},\n\t\texpect: false,\n\t},\n\t}\n\n\tfor _, tc := range tests {\n\t\tt.Run(\"\", func(t *testing.T) {\n\t\t\tvar lines []string\n\t\t\tfor _, l := range tc.lines {\n\t\t\t\tlines = append(lines, l)\n\t\t\t}\n\t\t\tcont, indent := continueLine(lines)\n\t\t\tif cont != tc.expect {\n\t\t\t\tt.Errorf(\"Expected %v but got %v for %#v\", tc.expect, cont, tc.lines)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif indent != tc.indent {\n\t\t\t\tt.Errorf(\"Expected %d but got %d for %#v\", tc.indent, indent, tc.lines)\n\t\t\t}\n\t\t})\n\t}\n}\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/ibarryyan/golang-tips-100"},"file":{"path":"code/code_01/main_exit.go","url":"/github.com/ibarryyan/golang-tips-100/-/blob/code/code_01/main_exit.go","content":"package main\n\nfunc main() {\n\tdefer func() {for {}}()\n\t// TODO\n}\n\nfunc main() {\n\tdefer func() { select {} }()\n\t// TODO\n}\n\nfunc main() {\n\t// TODO\n\tselect {}\n}"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/unigornel/unigornel"},"file":{"path":"integration_tests/tests/console/simple/main.go","url":"/github.com/unigornel/unigornel/-/blob/integration_tests/tests/console/simple/main.go","content":"package main\n\nimport \"C\"\nimport \"fmt\"\n\nfunc main() {}\n\n//export Main\nfunc Main(unused int) {\n\tfmt.Printf(\"Hello World!\\n\")\n}\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/jiro4989/textimg"},"file":{"path":"main.go","url":"/github.com/jiro4989/textimg/-/blob/main.go","content":"package main\n\nimport (\n\t\"os\"\n)\n\nfunc main() {\n\tos.Exit(Main())\n}\n\nfunc Main() int {\n\tif err := RootCommand.Execute(); err != nil {\n\t\treturn -1\n\t}\n\treturn 0\n}\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/naeemaei/Golang-Tutorial"},"file":{"path":"15-Concurrency/09-Channels/main.go","url":"/github.com/naeemaei/Golang-Tutorial/-/blob/15-Concurrency/09-Channels/main.go","content":"package main\n\nimport \"concurrency/examples\"\n\nfunc main() {\n\texamples.RunHttpExample2()\n\t//examples.RunHttpUExample2()\n}\npackage main\n\nfunc main() {\n\t\t\n}"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/unigornel/unigornel"},"file":{"path":"integration_tests/tests/console/sleep_and_time/main.go","url":"/github.com/unigornel/unigornel/-/blob/integration_tests/tests/console/sleep_and_time/main.go","content":"package main\n\nimport \"C\"\nimport (\n\t\"fmt\"\n\t\"time\"\n)\n\nfunc main() {}\n\n//export Main\nfunc Main(unused int) {\n\tfor {\n\t\tt := time.Now()\n\t\tfmt.Printf(\"%v [%v] Hello World!\\n\", t.UnixNano(), t.UTC())\n\t\ttime.Sleep(100 * time.Millisecond)\n\t}\n}\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/unigornel/unigornel"},"file":{"path":"integration_tests/tests/console/read_from_console/main.go","url":"/github.com/unigornel/unigornel/-/blob/integration_tests/tests/console/read_from_console/main.go","content":"package main\n\nimport \"C\"\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n\t\"strings\"\n)\n\nfunc main() {\n\tMain(0)\n}\n\n//export Main\nfunc Main(unused int) {\n\treader := bufio.NewReader(os.Stdin)\n\n\tfmt.Print(\"Hello, what''s your name? \")\n\tname, _ := reader.ReadString(''\\n'')\n\tfmt.Printf(\"Hello, %s\\n\", strings.TrimSpace(name))\n}\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/MichaelCade/90DaysOfDevOps"},"file":{"path":"2022/tr/Days/Go/hello.go","url":"/github.com/MichaelCade/90DaysOfDevOps/-/blob/2022/tr/Days/Go/hello.go","content":"\u003c\u003c\u003c\u003c\u003c\u003c\u003c HEAD:2022/es/Days/Go/hello.go\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Println(\"Until tomorrow #90DaysOfDevOps\")\n}\n=======\npackage main\r\n\r\nimport \"fmt\"\r\n\r\nfunc main() {\r\n\tfmt.Println(\"Hasta mañana #90DaysOfDevOps\")\r\n}\r\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e feature/translateES-03-adaptation:es/Days/Go/hello.go\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/MichaelCade/90DaysOfDevOps"},"file":{"path":"2022/es/Days/Go/hello.go","url":"/github.com/MichaelCade/90DaysOfDevOps/-/blob/2022/es/Days/Go/hello.go","content":"\u003c\u003c\u003c\u003c\u003c\u003c\u003c HEAD:2022/es/Days/Go/hello.go\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Println(\"Until tomorrow #90DaysOfDevOps\")\n}\n=======\npackage main\r\n\r\nimport \"fmt\"\r\n\r\nfunc main() {\r\n\tfmt.Println(\"Hasta mañana #90DaysOfDevOps\")\r\n}\r\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e feature/translateES-03-adaptation:es/Days/Go/hello.go\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/gostaticanalysis/skeleton"},"file":{"path":"v2/skeleton/_template/ssa/cmd/@@.Pkg@@/main.go","url":"/github.com/gostaticanalysis/skeleton/-/blob/v2/skeleton/_template/ssa/cmd/@@.Pkg@@/main.go","content":"@@ if .Cmd -@@\npackage main\n\nimport (\n\t\"@@.Path@@\"\n\t\"golang.org/x/tools/go/analysis/@@.Checker@@checker\"\n)\n\nfunc main() { @@.Checker@@checker.Main(@@.Pkg@@.Analyzer) }\n@@ end -@@\n@@ if eq .Kind \"codegen\" -@@\npackage main\n\nimport (\n\t\"@@.Path@@\"\n\t\"github.com/gostaticanalysis/codegen/@@.Checker@@generator\"\n)\n\nfunc main() {\n\t@@.Checker@@generator.Main(@@.Pkg@@.Generator)\n}\n@@end@@\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/gqlgo/gqlanalysis"},"file":{"path":"cmd/gqlskeleton/_template/cmd/@@.Pkg@@/main.go","url":"/github.com/gqlgo/gqlanalysis/-/blob/cmd/gqlskeleton/_template/cmd/@@.Pkg@@/main.go","content":"@@ if .Cmd -@@\n@@ if eq .Kind \"query\" -@@\npackage main\n\nimport (\n\t\"@@.Path@@\"\n\t\"github.com/gqlgo/gqlanalysis/multichecker\"\n)\n\nfunc main() { multichecker.Main(@@.Pkg@@.Analyzer) }\n@@ end -@@\n@@ if eq .Kind \"codegen\" -@@\npackage main\n\nimport (\n\t\"@@.Path@@\"\n\t\"github.com/gqlgo/gqlanalysis/codegen\"\n)\n\nfunc main() {\n\tcodegen.Main(@@.Pkg@@.Generator)\n}\n@@ end -@@\n@@end@@\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/mateors/master_academy"},"file":{"path":"main.go","url":"/github.com/mateors/master_academy/-/blob/main.go","content":"package main\n\nimport \"fmt\"\n\n\u003c\u003c\u003c\u003c\u003c\u003c\u003c HEAD\nfunc main(){\n\n//primitive data types\n//rune, byte = alias\n//int, float32,string, bool\n\n//Composite Data Types Maps\n//Maps\n//Key = value\n\n//null\n//nil\n\n//var x map[string]string\nx := make(map[string]string)\n\nx[\"name\"] = \"Mostain\"\nx[\"height\"] = \"5.7\"\nx[\"address\"] = \"Dhaka\"\n\n//delete(x, \"height\")\n\nfmt.Println(x)\n\n}\n=======\nfunc main() {\n\n\tfmt.Println(\"Hello Bangladesh\")\n\tfmt.Println(\"github local to remote\")\n\n}\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e 7a52c93944fafce3cf182700c40abfb57ed7a14b\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/gostaticanalysis/skeleton"},"file":{"path":"_template/cmd/@@.Pkg@@/main.go","url":"/github.com/gostaticanalysis/skeleton/-/blob/_template/cmd/@@.Pkg@@/main.go","content":"@@ if .Cmd -@@\n@@ if (or (eq .Type \"inspect\") (eq .Type \"ssa\")) -@@\npackage main\n\nimport (\n\t\"@@.ImportPath@@\"\n\t\"golang.org/x/tools/go/analysis/@@.Checker@@checker\"\n)\n\nfunc main() { @@.Checker@@checker.Main(@@.Pkg@@.Analyzer) }\n@@ end -@@\n@@ if eq .Type \"codegen\" -@@\npackage main\n\nimport (\n\t\"@@.ImportPath@@\"\n\t\"github.com/gostaticanalysis/codegen/@@.Checker@@generator\"\n)\n\nfunc main() {\n\t@@.Checker@@generator.Main(@@.Pkg@@.Generator)\n}\n@@ end -@@\n@@end@@\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/Avtostopom-po-Go/Avtostopom_po_Go_course"},"file":{"path":"easy level/slice.go","url":"/github.com/Avtostopom-po-Go/Avtostopom_po_Go_course/-/blob/easy%20level/slice.go","content":"package main\n\nimport \"fmt\"\n\n// 1\n// Какой будет результат выполнения приложения?\nfunc main() {\n\ta := []string{\"a\", \"b\", \"c\"}\n\tb := a[1:2]\n\tb[0] = \"q\"\n\tfmt.Println(a)\n}\n\n// 2\n// Что выведет код и почему?\nfunc mod(a []int) {\n\ta = append(a, 125)\n\tfor i := range a {\n\t\ta[i] = 5\n\t}\n\tfmt.Println(a)\n}\nfunc main() {\n\tsl := []int{1, 2, 3, 4, 5}\n\tmod(sl)\n\tfmt.Println(sl)\n}\n\n// 3\n// Что выведет код и почему?\nfunc mod(a []int) {\n\tfor i := range a {\n\t\ta[i] = 5\n\t}\n\tfmt.Println(a)\n}\nfunc main() {\n\tsl := make([]int, 4, 8)\n\tsl[0] = 1\n\tsl[1] = 2\n\tsl[2] = 3\n\tsl[3] = 5\n\tmod(sl)\n\tfmt.Println(sl)\n}\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/thongtech/go-legacy-win7"},"file":{"path":"test/mainsig.go","url":"/github.com/thongtech/go-legacy-win7/-/blob/test/mainsig.go","content":"// errorcheck\n\n// Copyright 2020 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage main\n\nfunc main(int) {} // ERROR \"func main must have no arguments and no return values\"\nfunc main() int { return 1 } // ERROR \"func main must have no arguments and no return values\" \"main redeclared in this block\"\n\nfunc init(int) {} // ERROR \"func init must have no arguments and no return values\"\nfunc init() int { return 1 } // ERROR \"func init must have no arguments and no return values\"\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/golang/go"},"file":{"path":"test/mainsig.go","url":"/github.com/golang/go/-/blob/test/mainsig.go","content":"// errorcheck\n\n// Copyright 2020 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage main\n\nfunc main(int) {} // ERROR \"func main must have no arguments and no return values\"\nfunc main() int { return 1 } // ERROR \"func main must have no arguments and no return values\" \"main redeclared in this block\"\n\nfunc init(int) {} // ERROR \"func init must have no arguments and no return values\"\nfunc init() int { return 1 } // ERROR \"func init must have no arguments and no return values\"\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/ibarryyan/golang-tips-100"},"file":{"path":"code/code_14/float_int_compute.go","url":"/github.com/ibarryyan/golang-tips-100/-/blob/code/code_14/float_int_compute.go","content":"package main\n\nimport (\n\t\"fmt\"\n)\n\nfunc main() {\n\t// 定义两个float64类型的小数\n\ta := 3.14\n\tb := 2.71\n\n\t// 乘法\n\tproduct := a * b\n\tfmt.Printf(\"Product: %f\\n\", product)\n\n\t// 除法\n\tquotient := a / b\n\tfmt.Printf(\"Quotient: %f\\n\", quotient)\n}\n\nfunc main() {\n\t// 定义两个int32类型的变量\n\ta := int32(10)\n\tb := int32(3)\n\n\t// 将它们转换为float64类型以执行除法运算\n\tresult := float64(a) / float64(b)\n\n\t// 使用fmt.Printf格式化输出,保留两位小数\n\tfmt.Printf(\"Result: %.2f\\n\", result)\n}\n\nfunc main() {\n\t// 定义两个int32类型的变量\n\ta := int32(10)\n\tb := int32(3)\n\n\t// 将它们转换为float64类型以执行除法运算\n\tresult := float64(a) / float64(b)\n\n\t// 使用fmt.Printf格式化输出,保留两位小数\n\tfmt.Printf(\"Result: %.2f\\n\", result)\n}\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/Avtostopom-po-Go/Avtostopom_po_Go_course"},"file":{"path":"interview level/tasks/task5.go","url":"/github.com/Avtostopom-po-Go/Avtostopom_po_Go_course/-/blob/interview%20level/tasks/task5.go","content":"//Добавить код, который выведет тип переменной whoami\n\nfunc printType(whoami interface{}) {\n\n}\n\nfunc main() {\n\tprintType(42)\n\tprintType(\"im string\")\n\tprintType(true)\n}\n\n\n//Ответ:\n\npackage main\n\nimport \"fmt\"\n\nfunc printType(whoami interface{}) {\n\tfmt.Printf(\"Type of whoami: %T\\n\", whoami)\n\t//fmt.Printf(\"Type of whoami: %v\\n\", reflect.TypeOf(whoami))\n}\n\nfunc main() {\n\tprintType(42)\n\tprintType(\"im string\")\n\tprintType(true)\n}"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/moegi-design/vscode-theme"},"file":{"path":"examples/go.go","url":"/github.com/moegi-design/vscode-theme/-/blob/examples/go.go","content":"\n// 1. Example ----------------------------------\n\npackage main\n\nimport \"fmt\"\nfunc main() {\n fmt.Println(\"hello world\")\n}\n\n\n// 2. Tests ----------------------------------\n\n// Values\nfmt.Println(\"go\" + \"lang\")\nfmt.Println(\"1+1 =\", 1+1)\nfmt.Println(\"7.0/3.0 =\", 7.0/3.0)\nfmt.Println(true \u0026\u0026 false)\nfmt.Println(true || false)\nfmt.Println(!true)\n\n// Variables\nvar a string = \"initial\"\nvar b, c int = 1, 2\nvar d = true\nvar e int\nf := \"short\"\n\n// Constants\nconst n = 500000000\nconst d = 3e20 / n\n\n// For\nfor j := 7; j \u003c= 9; j++ {\n fmt.Println(j)\n}\n\n// If/Else\nif 7%2 == 0 {\n fmt.Println(\"7 is even\")\n} else {\n fmt.Println(\"7 is odd\")\n}\n\n// Array\nb := [5]int{1, 2, 3, 4, 5}\nfmt.Println(\"dcl:\", b)\n\n// Function\nfunc main() {\n res := plus(1, 2)\n fmt.Println(\"1+2 =\", res)\n\n res = plusPlus(1, 2, 3)\n fmt.Println(\"1+2+3 =\", res)\n}\n"},"lineMatches":[]},{"__typename":"FileMatch","repository":{"name":"github.com/blaumedia/go-gtm-ga-proxy"},"file":{"path":"plugins/plugin-example.go","url":"/github.com/blaumedia/go-gtm-ga-proxy/-/blob/plugins/plugin-example.go","content":"package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n)\n\n// Dispatcher saves all dispatch-functions in it.\nvar Dispatcher map[string][]func(*http.ResponseWriter, *http.Request, *int, *[]byte)\n\n// Main function integrates the trigger and functions into the Dispatcher map.\nfunc Main() {\n\tDispatcher = make(map[string][]func(*http.ResponseWriter, *http.Request, *int, *[]byte))\n\n\tDispatcher[`after_ga_js`] = append(Dispatcher[`after_ga_js`], func(w *http.ResponseWriter, r *http.Request, statusCodeToReturn *int, sourceCodeToReturn *[]byte) {\n\t\tfmt.Println(\"PLUGIN: Executed on event ''after_ga_js''!\")\n\t\t(*w).Header().Add(`X-Plugin`, `Injected`)\n\t})\n\n\tfmt.Println(\"PLUGIN: Injected!\")\n}\n\nfunc main() {}\n"},"lineMatches":[]}]}}}}' + body: '{"data":{"search":{"results":{"matchCount":10,"limitHit":true,"resultCount":10,"approximateResultCount":"10+","missing":[],"timedout":[],"indexUnavailable":false,"results":[{"__typename":"FileMatch","repository":{"name":"github.com/yinchengtsinghua/go-ethereum-chinese"},"file":{"path":"cmd/wnode/main.go","url":"/github.com/yinchengtsinghua/go-ethereum-chinese/-/blob/cmd/wnode/main.go","content":"\n//此源码被清华学神尹成大魔王专业翻译分析并修改\n//尹成QQ77025077\n//尹成微信18510341407\n//尹成所在QQ群721929980\n//尹成邮箱 yinc13@mails.tsinghua.edu.cn\n//尹成毕业于清华大学,微软区块链领域全球最有价值专家\n//https://mvp.microsoft.com/zh-cn/PublicProfile/4033620\n//版权所有2017 Go Ethereum作者\n//此文件是Go以太坊的一部分。\n//\n//Go以太坊是免费软件:您可以重新发布和/或修改它\n//根据GNU通用公共许可证的条款\n//自由软件基金会,或者许可证的第3版,或者\n//(由您选择)任何更高版本。\n//\n//Go以太坊的分布希望它会有用,\n//但没有任何保证;甚至没有\n//适销性或特定用途的适用性。见\n//GNU通用公共许可证了解更多详细信息。\n//\n//你应该已经收到一份GNU通用公共许可证的副本\n//一起去以太坊吧。如果没有,请参见\u003chttp://www.gnu.org/licenses/\u003e。\n\n//这是一个简单的耳语节点。它可以用作独立的引导节点。\n//也可用于不同的测试和诊断目的。\n\npackage main\n\nimport (\n\t\"bufio\"\n\t\"crypto/ecdsa\"\n\tcrand \"crypto/rand\"\n\t\"crypto/sha512\"\n\t\"encoding/binary\"\n\t\"encoding/hex\"\n\t\"flag\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/ethereum/go-ethereum/cmd/utils\"\n\t\"github.com/ethereum/go-ethereum/common\"\n\t\"github.com/ethereum/go-ethereum/console\"\n\t\"github.com/ethereum/go-ethereum/crypto\"\n\t\"github.com/ethereum/go-ethereum/log\"\n\t\"github.com/ethereum/go-ethereum/p2p\"\n\t\"github.com/ethereum/go-ethereum/p2p/enode\"\n\t\"github.com/ethereum/go-ethereum/p2p/nat\"\n\t\"github.com/ethereum/go-ethereum/whisper/mailserver\"\n\twhisper \"github.com/ethereum/go-ethereum/whisper/whisperv6\"\n\t\"golang.org/x/crypto/pbkdf2\"\n)\n\nconst quitCommand = \"~Q\"\nconst entropySize = 32\n\n//独生子女\nvar (\n\tserver *p2p.Server\n\tshh *whisper.Whisper\n\tdone chan struct{}\n\tmailServer mailserver.WMailServer\n\tentropy [entropySize]byte\n\n\tinput = bufio.NewReader(os.Stdin)\n)\n\n//加密\nvar (\n\tsymKey []byte\n\tpub *ecdsa.PublicKey\n\tasymKey *ecdsa.PrivateKey\n\tnodeid *ecdsa.PrivateKey\n\ttopic whisper.TopicType\n\n\tasymKeyID string\n\tasymFilterID string\n\tsymFilterID string\n\tsymPass string\n\tmsPassword string\n)\n\n//CMD参数\nvar (\n\tbootstrapMode = flag.Bool(\"standalone\", false, \"boostrap node: don''t initiate connection to peers, just wait for incoming connections\")\n\tforwarderMode = flag.Bool(\"forwarder\", false, \"forwarder mode: only forward messages, neither encrypt nor decrypt messages\")\n\tmailServerMode = flag.Bool(\"mailserver\", false, \"mail server mode: delivers expired messages on demand\")\n\trequestMail = flag.Bool(\"mailclient\", false, \"request expired messages from the bootstrap server\")\n\tasymmetricMode = flag.Bool(\"asym\", false, \"use asymmetric encryption\")\n\tgenerateKey = flag.Bool(\"generatekey\", false, \"generate and show the private key\")\n\tfileExMode = flag.Bool(\"fileexchange\", false, \"file exchange mode\")\n\tfileReader = flag.Bool(\"filereader\", false, \"load and decrypt messages saved as files, display as plain text\")\n\ttestMode = flag.Bool(\"test\", false, \"use of predefined parameters for diagnostics (password, etc.)\")\n\techoMode = flag.Bool(\"echo\", false, \"echo mode: prints some arguments for diagnostics\")\n\n\targVerbosity = flag.Int(\"verbosity\", int(log.LvlError), \"log verbosity level\")\n\targTTL = flag.Uint(\"ttl\", 30, \"time-to-live for messages in seconds\")\n\targWorkTime = flag.Uint(\"work\", 5, \"work time in seconds\")\n\targMaxSize = flag.Uint(\"maxsize\", uint(whisper.DefaultMaxMessageSize), \"max size of message\")\n\targPoW = flag.Float64(\"pow\", whisper.DefaultMinimumPoW, \"PoW for normal messages in float format (e.g. 2.7)\")\n\targServerPoW = flag.Float64(\"mspow\", whisper.DefaultMinimumPoW, \"PoW requirement for Mail Server request\")\n\n\targIP = flag.String(\"ip\", \"\", \"IP address and port of this node (e.g. 127.0.0.1:30303)\")\n\targPub = flag.String(\"pub\", \"\", \"public key for asymmetric encryption\")\n\targDBPath = flag.String(\"dbpath\", \"\", \"path to the server''s DB directory\")\n\targIDFile = flag.String(\"idfile\", \"\", \"file name with node id (private key)\")\nargEnode = flag.String(\"boot\", \"\", \"bootstrap node you want to connect to (e.g. enode://E454……08D50@52.176.211.200:16428)”)\n\targTopic = flag.String(\"topic\", \"\", \"topic in hexadecimal format (e.g. 70a4beef)\")\n\targSaveDir = flag.String(\"savedir\", \"\", \"directory where all incoming messages will be saved as files\")\n)\n\nfunc main() {\n\tprocessArgs()\n\tinitialize()\n\trun()\n\tshutdown()\n}\n\nfunc processArgs() {\n\tflag.Parse()\n\n\tif len(*argIDFile) \u003e 0 {\n\t\tvar err error\n\t\tnodeid, err = crypto.LoadECDSA(*argIDFile)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to load file [%s]: %s.\", *argIDFile, err)\n\t\t}\n\t}\n\nconst enodePrefix = \"enode://“\n\tif len(*argEnode) \u003e 0 {\n\t\tif (*argEnode)[:len(enodePrefix)] != enodePrefix {\n\t\t\t*argEnode = enodePrefix + *argEnode\n\t\t}\n\t}\n\n\tif len(*argTopic) \u003e 0 {\n\t\tx, err := hex.DecodeString(*argTopic)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to parse the topic: %s\", err)\n\t\t}\n\t\ttopic = whisper.BytesToTopic(x)\n\t}\n\n\tif *asymmetricMode \u0026\u0026 len(*argPub) \u003e 0 {\n\t\tvar err error\n\t\tif pub, err = crypto.UnmarshalPubkey(common.FromHex(*argPub)); err != nil {\n\t\t\tutils.Fatalf(\"invalid public key\")\n\t\t}\n\t}\n\n\tif len(*argSaveDir) \u003e 0 {\n\t\tif _, err := os.Stat(*argSaveDir); os.IsNotExist(err) {\n\t\t\tutils.Fatalf(\"Download directory ''%s'' does not exist\", *argSaveDir)\n\t\t}\n\t} else if *fileExMode {\n\t\tutils.Fatalf(\"Parameter ''savedir'' is mandatory for file exchange mode\")\n\t}\n\n\tif *echoMode {\n\t\techo()\n\t}\n}\n\nfunc echo() {\n\tfmt.Printf(\"ttl = %d \\n\", *argTTL)\n\tfmt.Printf(\"workTime = %d \\n\", *argWorkTime)\n\tfmt.Printf(\"pow = %f \\n\", *argPoW)\n\tfmt.Printf(\"mspow = %f \\n\", *argServerPoW)\n\tfmt.Printf(\"ip = %s \\n\", *argIP)\n\tfmt.Printf(\"pub = %s \\n\", common.ToHex(crypto.FromECDSAPub(pub)))\n\tfmt.Printf(\"idfile = %s \\n\", *argIDFile)\n\tfmt.Printf(\"dbpath = %s \\n\", *argDBPath)\n\tfmt.Printf(\"boot = %s \\n\", *argEnode)\n}\n\nfunc initialize() {\n\tlog.Root().SetHandler(log.LvlFilterHandler(log.Lvl(*argVerbosity), log.StreamHandler(os.Stderr, log.TerminalFormat(false))))\n\n\tdone = make(chan struct{})\n\tvar peers []*enode.Node\n\tvar err error\n\n\tif *generateKey {\n\t\tkey, err := crypto.GenerateKey()\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to generate private key: %s\", err)\n\t\t}\n\t\tk := hex.EncodeToString(crypto.FromECDSA(key))\n\t\tfmt.Printf(\"Random private key: %s \\n\", k)\n\t\tos.Exit(0)\n\t}\n\n\tif *testMode {\nsymPass = \"wwww\" //ASCII码:0x77777777\n\t\tmsPassword = \"wwww\"\n\t}\n\n\tif *bootstrapMode {\n\t\tif len(*argIP) == 0 {\n\t\t\targIP = scanLineA(\"Please enter your IP and port (e.g. 127.0.0.1:30348): \")\n\t\t}\n\t} else if *fileReader {\n\t\t*bootstrapMode = true\n\t} else {\n\t\tif len(*argEnode) == 0 {\n\t\t\targEnode = scanLineA(\"Please enter the peer''s enode: \")\n\t\t}\n\t\tpeer := enode.MustParseV4(*argEnode)\n\t\tpeers = append(peers, peer)\n\t}\n\n\tif *mailServerMode {\n\t\tif len(msPassword) == 0 {\n\t\t\tmsPassword, err = console.Stdin.PromptPassword(\"Please enter the Mail Server password: \")\n\t\t\tif err != nil {\n\t\t\t\tutils.Fatalf(\"Failed to read Mail Server password: %s\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\tcfg := \u0026whisper.Config{\n\t\tMaxMessageSize: uint32(*argMaxSize),\n\t\tMinimumAcceptedPOW: *argPoW,\n\t}\n\n\tshh = whisper.New(cfg)\n\n\tif *argPoW != whisper.DefaultMinimumPoW {\n\t\terr := shh.SetMinimumPoW(*argPoW)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to set PoW: %s\", err)\n\t\t}\n\t}\n\n\tif uint32(*argMaxSize) != whisper.DefaultMaxMessageSize {\n\t\terr := shh.SetMaxMessageSize(uint32(*argMaxSize))\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to set max message size: %s\", err)\n\t\t}\n\t}\n\n\tasymKeyID, err = shh.NewKeyPair()\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to generate a new key pair: %s\", err)\n\t}\n\n\tasymKey, err = shh.GetPrivateKey(asymKeyID)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to retrieve a new key pair: %s\", err)\n\t}\n\n\tif nodeid == nil {\n\t\ttmpID, err := shh.NewKeyPair()\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to generate a new key pair: %s\", err)\n\t\t}\n\n\t\tnodeid, err = shh.GetPrivateKey(tmpID)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to retrieve a new key pair: %s\", err)\n\t\t}\n\t}\n\n\tmaxPeers := 80\n\tif *bootstrapMode {\n\t\tmaxPeers = 800\n\t}\n\n\t_, err = crand.Read(entropy[:])\n\tif err != nil {\n\t\tutils.Fatalf(\"crypto/rand failed: %s\", err)\n\t}\n\n\tif *mailServerMode {\n\t\tshh.RegisterServer(\u0026mailServer)\n\t\tif err := mailServer.Init(shh, *argDBPath, msPassword, *argServerPoW); err != nil {\n\t\t\tutils.Fatalf(\"Failed to init MailServer: %s\", err)\n\t\t}\n\t}\n\n\tserver = \u0026p2p.Server{\n\t\tConfig: p2p.Config{\n\t\t\tPrivateKey: nodeid,\n\t\t\tMaxPeers: maxPeers,\n\t\t\tName: common.MakeName(\"wnode\", \"6.0\"),\n\t\t\tProtocols: shh.Protocols(),\n\t\t\tListenAddr: *argIP,\n\t\t\tNAT: nat.Any(),\n\t\t\tBootstrapNodes: peers,\n\t\t\tStaticNodes: peers,\n\t\t\tTrustedNodes: peers,\n\t\t},\n\t}\n}\n\nfunc startServer() error {\n\terr := server.Start()\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to start Whisper peer: %s.\", err)\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"my public key: %s \\n\", common.ToHex(crypto.FromECDSAPub(\u0026asymKey.PublicKey)))\n\tfmt.Println(server.NodeInfo().Enode)\n\n\tif *bootstrapMode {\n\t\tconfigureNode()\n\t\tfmt.Println(\"Bootstrap Whisper node started\")\n\t} else {\n\t\tfmt.Println(\"Whisper node started\")\n//首先看看我们是否可以建立连接,然后请求用户输入\n\t\twaitForConnection(true)\n\t\tconfigureNode()\n\t}\n\n\tif *fileExMode {\n\t\tfmt.Printf(\"Please type the file name to be send. To quit type: ''%s''\\n\", quitCommand)\n\t} else if *fileReader {\n\t\tfmt.Printf(\"Please type the file name to be decrypted. To quit type: ''%s''\\n\", quitCommand)\n\t} else if !*forwarderMode {\n\t\tfmt.Printf(\"Please type the message. To quit type: ''%s''\\n\", quitCommand)\n\t}\n\treturn nil\n}\n\nfunc configureNode() {\n\tvar err error\n\tvar p2pAccept bool\n\n\tif *forwarderMode {\n\t\treturn\n\t}\n\n\tif *asymmetricMode {\n\t\tif len(*argPub) == 0 {\n\t\t\ts := scanLine(\"Please enter the peer''s public key: \")\n\t\t\tb := common.FromHex(s)\n\t\t\tif b == nil {\n\t\t\t\tutils.Fatalf(\"Error: can not convert hexadecimal string\")\n\t\t\t}\n\t\t\tif pub, err = crypto.UnmarshalPubkey(b); err != nil {\n\t\t\t\tutils.Fatalf(\"Error: invalid peer public key\")\n\t\t\t}\n\t\t}\n\t}\n\n\tif *requestMail {\n\t\tp2pAccept = true\n\t\tif len(msPassword) == 0 {\n\t\t\tmsPassword, err = console.Stdin.PromptPassword(\"Please enter the Mail Server password: \")\n\t\t\tif err != nil {\n\t\t\t\tutils.Fatalf(\"Failed to read Mail Server password: %s\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\tif !*asymmetricMode \u0026\u0026 !*forwarderMode {\n\t\tif len(symPass) == 0 {\n\t\t\tsymPass, err = console.Stdin.PromptPassword(\"Please enter the password for symmetric encryption: \")\n\t\t\tif err != nil {\n\t\t\t\tutils.Fatalf(\"Failed to read passphrase: %v\", err)\n\t\t\t}\n\t\t}\n\n\t\tsymKeyID, err := shh.AddSymKeyFromPassword(symPass)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to create symmetric key: %s\", err)\n\t\t}\n\t\tsymKey, err = shh.GetSymKey(symKeyID)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to save symmetric key: %s\", err)\n\t\t}\n\t\tif len(*argTopic) == 0 {\n\t\t\tgenerateTopic([]byte(symPass))\n\t\t}\n\n\t\tfmt.Printf(\"Filter is configured for the topic: %x \\n\", topic)\n\t}\n\n\tif *mailServerMode {\n\t\tif len(*argDBPath) == 0 {\n\t\t\targDBPath = scanLineA(\"Please enter the path to DB file: \")\n\t\t}\n\t}\n\n\tsymFilter := whisper.Filter{\n\t\tKeySym: symKey,\n\t\tTopics: [][]byte{topic[:]},\n\t\tAllowP2P: p2pAccept,\n\t}\n\tsymFilterID, err = shh.Subscribe(\u0026symFilter)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to install filter: %s\", err)\n\t}\n\n\tasymFilter := whisper.Filter{\n\t\tKeyAsym: asymKey,\n\t\tTopics: [][]byte{topic[:]},\n\t\tAllowP2P: p2pAccept,\n\t}\n\tasymFilterID, err = shh.Subscribe(\u0026asymFilter)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to install filter: %s\", err)\n\t}\n}\n\nfunc generateTopic(password []byte) {\n\tx := pbkdf2.Key(password, password, 4096, 128, sha512.New)\n\tfor i := 0; i \u003c len(x); i++ {\n\t\ttopic[i%whisper.TopicLength] ^= x[i]\n\t}\n}\n\nfunc waitForConnection(timeout bool) {\n\tvar cnt int\n\tvar connected bool\n\tfor !connected {\n\t\ttime.Sleep(time.Millisecond * 50)\n\t\tconnected = server.PeerCount() \u003e 0\n\t\tif timeout {\n\t\t\tcnt++\n\t\t\tif cnt \u003e 1000 {\n\t\t\t\tutils.Fatalf(\"Timeout expired, failed to connect\")\n\t\t\t}\n\t\t}\n\t}\n\n\tfmt.Println(\"Connected to peer.\")\n}\n\nfunc run() {\n\terr := startServer()\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer server.Stop()\n\tshh.Start(nil)\n\tdefer shh.Stop()\n\n\tif !*forwarderMode {\n\t\tgo messageLoop()\n\t}\n\n\tif *requestMail {\n\t\trequestExpiredMessagesLoop()\n\t} else if *fileExMode {\n\t\tsendFilesLoop()\n\t} else if *fileReader {\n\t\tfileReaderLoop()\n\t} else {\n\t\tsendLoop()\n\t}\n}\n\nfunc shutdown() {\n\tclose(done)\n\tmailServer.Close()\n}\n\nfunc sendLoop() {\n\tfor {\n\t\ts := scanLine(\"\")\n\t\tif s == quitCommand {\n\t\t\tfmt.Println(\"Quit command received\")\n\t\t\treturn\n\t\t}\n\t\tsendMsg([]byte(s))\n\t\tif *asymmetricMode {\n//为方便起见,请打印您自己的消息,\n//因为在非对称模式下是不可能解密的\n\t\t\ttimestamp := time.Now().Unix()\n\t\t\tfrom := crypto.PubkeyToAddress(asymKey.PublicKey)\n\t\t\tfmt.Printf(\"\\n%d \u003c%x\u003e: %s\\n\", timestamp, from, s)\n\t\t}\n\t}\n}\n\nfunc sendFilesLoop() {\n\tfor {\n\t\ts := scanLine(\"\")\n\t\tif s == quitCommand {\n\t\t\tfmt.Println(\"Quit command received\")\n\t\t\treturn\n\t\t}\n\t\tb, err := ioutil.ReadFile(s)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"\u003e\u003e\u003e Error: %s \\n\", err)\n\t\t} else {\n\t\t\th := sendMsg(b)\n\t\t\tif (h == common.Hash{}) {\n\t\t\t\tfmt.Printf(\"\u003e\u003e\u003e Error: message was not sent \\n\")\n\t\t\t} else {\n\t\t\t\ttimestamp := time.Now().Unix()\n\t\t\t\tfrom := crypto.PubkeyToAddress(asymKey.PublicKey)\n\t\t\t\tfmt.Printf(\"\\n%d \u003c%x\u003e: sent message with hash %x\\n\", timestamp, from, h)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc fileReaderLoop() {\n\twatcher1 := shh.GetFilter(symFilterID)\n\twatcher2 := shh.GetFilter(asymFilterID)\n\tif watcher1 == nil \u0026\u0026 watcher2 == nil {\n\t\tfmt.Println(\"Error: neither symmetric nor asymmetric filter is installed\")\n\t\treturn\n\t}\n\n\tfor {\n\t\ts := scanLine(\"\")\n\t\tif s == quitCommand {\n\t\t\tfmt.Println(\"Quit command received\")\n\t\t\treturn\n\t\t}\n\t\traw, err := ioutil.ReadFile(s)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"\u003e\u003e\u003e Error: %s \\n\", err)\n\t\t} else {\nenv := whisper.Envelope{Data: raw} //主题为零\nmsg := env.Open(watcher1) //不管主题如何,都强制打开信封\n\t\t\tif msg == nil {\n\t\t\t\tmsg = env.Open(watcher2)\n\t\t\t}\n\t\t\tif msg == nil {\n\t\t\t\tfmt.Printf(\"\u003e\u003e\u003e Error: failed to decrypt the message \\n\")\n\t\t\t} else {\n\t\t\t\tprintMessageInfo(msg)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc scanLine(prompt string) string {\n\tif len(prompt) \u003e 0 {\n\t\tfmt.Print(prompt)\n\t}\n\ttxt, err := input.ReadString(''\\n'')\n\tif err != nil {\n\t\tutils.Fatalf(\"input error: %s\", err)\n\t}\n\ttxt = strings.TrimRight(txt, \"\\n\\r\")\n\treturn txt\n}\n\nfunc scanLineA(prompt string) *string {\n\ts := scanLine(prompt)\n\treturn \u0026s\n}\n\nfunc scanUint(prompt string) uint32 {\n\ts := scanLine(prompt)\n\ti, err := strconv.Atoi(s)\n\tif err != nil {\n\t\tutils.Fatalf(\"Fail to parse the lower time limit: %s\", err)\n\t}\n\treturn uint32(i)\n}\n\nfunc sendMsg(payload []byte) common.Hash {\n\tparams := whisper.MessageParams{\n\t\tSrc: asymKey,\n\t\tDst: pub,\n\t\tKeySym: symKey,\n\t\tPayload: payload,\n\t\tTopic: topic,\n\t\tTTL: uint32(*argTTL),\n\t\tPoW: *argPoW,\n\t\tWorkTime: uint32(*argWorkTime),\n\t}\n\n\tmsg, err := whisper.NewSentMessage(\u0026params)\n\tif err != nil {\n\t\tutils.Fatalf(\"failed to create new message: %s\", err)\n\t}\n\n\tenvelope, err := msg.Wrap(\u0026params)\n\tif err != nil {\n\t\tfmt.Printf(\"failed to seal message: %v \\n\", err)\n\t\treturn common.Hash{}\n\t}\n\n\terr = shh.Send(envelope)\n\tif err != nil {\n\t\tfmt.Printf(\"failed to send message: %v \\n\", err)\n\t\treturn common.Hash{}\n\t}\n\n\treturn envelope.Hash()\n}\n\nfunc messageLoop() {\n\tsf := shh.GetFilter(symFilterID)\n\tif sf == nil {\n\t\tutils.Fatalf(\"symmetric filter is not installed\")\n\t}\n\n\taf := shh.GetFilter(asymFilterID)\n\tif af == nil {\n\t\tutils.Fatalf(\"asymmetric filter is not installed\")\n\t}\n\n\tticker := time.NewTicker(time.Millisecond * 50)\n\n\tfor {\n\t\tselect {\n\t\tcase \u003c-ticker.C:\n\t\t\tm1 := sf.Retrieve()\n\t\t\tm2 := af.Retrieve()\n\t\t\tmessages := append(m1, m2...)\n\t\t\tfor _, msg := range messages {\n\t\t\t\treportedOnce := false\n\t\t\t\tif !*fileExMode \u0026\u0026 len(msg.Payload) \u003c= 2048 {\n\t\t\t\t\tprintMessageInfo(msg)\n\t\t\t\t\treportedOnce = true\n\t\t\t\t}\n\n//在指定argsavedir时保存所有消息。\n//FileExMode仅指定消息保存后如何显示在控制台上。\n//如果fileexmode==true,则只显示哈希值,因为消息可能太大。\n\t\t\t\tif len(*argSaveDir) \u003e 0 {\n\t\t\t\t\twriteMessageToFile(*argSaveDir, msg, !reportedOnce)\n\t\t\t\t}\n\t\t\t}\n\t\tcase \u003c-done:\n\t\t\treturn\n\t\t}\n\t}\n}\n\nfunc printMessageInfo(msg *whisper.ReceivedMessage) {\ntimestamp := fmt.Sprintf(\"%d\", msg.Sent) //用于诊断的Unix时间戳\n\ttext := string(msg.Payload)\n\n\tvar address common.Address\n\tif msg.Src != nil {\n\t\taddress = crypto.PubkeyToAddress(*msg.Src)\n\t}\n\n\tif whisper.IsPubKeyEqual(msg.Src, \u0026asymKey.PublicKey) {\nfmt.Printf(\"\\n%s \u003c%x\u003e: %s\\n\", timestamp, address, text) //我的信息\n\t} else {\nfmt.Printf(\"\\n%s [%x]: %s\\n\", timestamp, address, text) //来自对等方的消息\n\t}\n}\n\nfunc writeMessageToFile(dir string, msg *whisper.ReceivedMessage, show bool) {\n\tif len(dir) == 0 {\n\t\treturn\n\t}\n\n\ttimestamp := fmt.Sprintf(\"%d\", msg.Sent)\n\tname := fmt.Sprintf(\"%x\", msg.EnvelopeHash)\n\n\tvar address common.Address\n\tif msg.Src != nil {\n\t\taddress = crypto.PubkeyToAddress(*msg.Src)\n\t}\n\n\tenv := shh.GetEnvelope(msg.EnvelopeHash)\n\tif env == nil {\n\t\tfmt.Printf(\"\\nUnexpected error: envelope not found: %x\\n\", msg.EnvelopeHash)\n\t\treturn\n\t}\n\n//这是一个示例代码;如果不想保存自己的消息,请取消注释。\n//如果whisper.ispubkeyequal(msg.src,\u0026asymkey.publickey)\n//fmt.printf(“\\n%s\u003c%x\u003e:我收到的消息,未保存:“%s''\\n”,时间戳,地址,名称)\n//返回\n//}\n\n\tfullpath := filepath.Join(dir, name)\n\terr := ioutil.WriteFile(fullpath, env.Data, 0644)\n\tif err != nil {\n\t\tfmt.Printf(\"\\n%s {%x}: message received but not saved: %s\\n\", timestamp, address, err)\n\t} else if show {\n\t\tfmt.Printf(\"\\n%s {%x}: message received and saved as ''%s'' (%d bytes)\\n\", timestamp, address, name, len(env.Data))\n\t}\n}\n\nfunc requestExpiredMessagesLoop() {\n\tvar key, peerID, bloom []byte\n\tvar timeLow, timeUpp uint32\n\tvar t string\n\tvar xt whisper.TopicType\n\n\tkeyID, err := shh.AddSymKeyFromPassword(msPassword)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to create symmetric key for mail request: %s\", err)\n\t}\n\tkey, err = shh.GetSymKey(keyID)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to save symmetric key for mail request: %s\", err)\n\t}\n\tpeerID = extractIDFromEnode(*argEnode)\n\tshh.AllowP2PMessagesFromPeer(peerID)\n\n\tfor {\n\t\ttimeLow = scanUint(\"Please enter the lower limit of the time range (unix timestamp): \")\n\t\ttimeUpp = scanUint(\"Please enter the upper limit of the time range (unix timestamp): \")\n\t\tt = scanLine(\"Enter the topic (hex). Press enter to request all messages, regardless of the topic: \")\n\t\tif len(t) == whisper.TopicLength*2 {\n\t\t\tx, err := hex.DecodeString(t)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Failed to parse the topic: %s \\n\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\txt = whisper.BytesToTopic(x)\n\t\t\tbloom = whisper.TopicToBloom(xt)\n\t\t\tobfuscateBloom(bloom)\n\t\t} else if len(t) == 0 {\n\t\t\tbloom = whisper.MakeFullNodeBloom()\n\t\t} else {\n\t\t\tfmt.Println(\"Error: topic is invalid, request aborted\")\n\t\t\tcontinue\n\t\t}\n\n\t\tif timeUpp == 0 {\n\t\t\ttimeUpp = 0xFFFFFFFF\n\t\t}\n\n\t\tdata := make([]byte, 8, 8+whisper.BloomFilterSize)\n\t\tbinary.BigEndian.PutUint32(data, timeLow)\n\t\tbinary.BigEndian.PutUint32(data[4:], timeUpp)\n\t\tdata = append(data, bloom...)\n\n\t\tvar params whisper.MessageParams\n\t\tparams.PoW = *argServerPoW\n\t\tparams.Payload = data\n\t\tparams.KeySym = key\n\t\tparams.Src = asymKey\n\t\tparams.WorkTime = 5\n\n\t\tmsg, err := whisper.NewSentMessage(\u0026params)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"failed to create new message: %s\", err)\n\t\t}\n\t\tenv, err := msg.Wrap(\u0026params)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Wrap failed: %s\", err)\n\t\t}\n\n\t\terr = shh.RequestHistoricMessages(peerID, env)\n\t\tif err != nil {\n\t\t\tutils.Fatalf(\"Failed to send P2P message: %s\", err)\n\t\t}\n\n\t\ttime.Sleep(time.Second * 5)\n\t}\n}\n\nfunc extractIDFromEnode(s string) []byte {\n\tn, err := enode.ParseV4(s)\n\tif err != nil {\n\t\tutils.Fatalf(\"Failed to parse enode: %s\", err)\n\t}\n\treturn n.ID().Bytes()\n}\n\n//模糊布卢姆增加16个随机位到布卢姆\n//筛选,以便混淆包含的主题。\n//它在每个会话中都具有确定性。\n//尽管有额外的位,它将平均匹配\n//比完整节点的Bloom过滤器少32000倍的消息。\nfunc obfuscateBloom(bloom []byte) {\n\tconst half = entropySize / 2\n\tfor i := 0; i \u003c half; i++ {\n\t\tx := int(entropy[i])\n\t\tif entropy[half+i] \u003c 128 {\n\t\t\tx += 256\n\t\t}\n\nbloom[x/8] = 1 \u003c\u003c uint(x%8) //设置位号x\n\t}\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":116,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/sergev/vak-opensource"},"file":{"path":"languages/go/lisp-light.go","url":"/github.com/sergev/vak-opensource/-/blob/languages/go/lisp-light.go","content":"/*\n Nukata Lisp Light 1.42 in Go 1.7 by SUZUKI Hisao (H27.5/11 - H28.9/8)\n\n This is a Lisp interpreter written in Go.\n It differs from the previous version(*1) in that all numbers are\n 64-bit floats and the whole interpreter consists of only one file.\n It is a \"light\" version.\n Intentionally it implements the same language as Nukata Lisp Light\n 1.26 in TypeScript 1.8(*2) except that it has also two concurrent\n constructs, future and force. See *3.\n\n *1: http://www.oki-osk.jp/esc/golang/lisp3.html (in Japanese)\n *2: http://www.oki-osk.jp/esc/typescript/lisp-en.html\n *3: http://www.oki-osk.jp/esc/golang/lisp4-en.html\n*/\npackage main\n\nimport (\n\t\"bufio\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"math\"\n\t\"os\"\n\t\"regexp\"\n\t\"runtime\"\n\t\"strconv\"\n\t\"strings\"\n\t\"sync\"\n\t\"unicode/utf8\"\n)\n\n// Cell represents a cons cell.\n// \u0026Cell{car, cdr} works as the \"cons\" operation.\ntype Cell struct {\n\tCar interface{}\n\tCdr interface{}\n}\n\n// Nil is a nil of type *Cell and it represents the empty list.\nvar Nil *Cell = nil\n\n// CdrCell returns cdr of the cell as a *Cell or Nil.\nfunc (j *Cell) CdrCell() *Cell {\n\tif c, ok := j.Cdr.(*Cell); ok {\n\t\treturn c\n\t}\n\tpanic(NewEvalError(\"proper list expected\", j))\n}\n\n// (a b c).FoldL(x, fn) returns fn(fn(fn(x, a), b), c)\nfunc (j *Cell) FoldL(x interface{},\n\tfn func(interface{}, interface{}) interface{}) interface{} {\n\tfor j != Nil {\n\t\tx = fn(x, j.Car)\n\t\tj = j.CdrCell()\n\t}\n\treturn x\n}\n\n// Len returns the length of list j\nfunc (j *Cell) Len() int {\n\treturn j.FoldL(0, func(i, e interface{}) interface{} {\n\t\treturn i.(int) + 1\n\t}).(int)\n}\n\n// (a b c).MapCar(fn) returns (fn(a) fn(b) fn(c))\nfunc (j *Cell) MapCar(fn func(interface{}) interface{}) interface{} {\n\tif j == Nil {\n\t\treturn Nil\n\t}\n\ta := fn(j.Car)\n\td := j.Cdr\n\tif cdr, ok := d.(*Cell); ok {\n\t\td = cdr.MapCar(fn)\n\t}\n\tif j.Car == a \u0026\u0026 j.Cdr == d {\n\t\treturn j\n\t}\n\treturn \u0026Cell{a, d}\n}\n\n// String returns a raw textual representation of j for debugging.\nfunc (j *Cell) String() string {\n\treturn fmt.Sprintf(\"(%v . %v)\", j.Car, j.Cdr)\n}\n\n//----------------------------------------------------------------------\n\n// Sym represents a symbol (or an expression keyword) in Lisp.\n// \u0026Sym{name, false} constructs a symbol which is not interned yet.\ntype Sym struct {\n\tName string\n\tIsKeyword bool\n}\n\n// NewSym constructs an interned symbol for name.\nfunc NewSym(name string) *Sym {\n\treturn NewSym2(name, false)\n}\n\n// symbols is a table of interned symbols.\nvar symbols = make(map[string]*Sym)\n\n// symLock is an exclusive lock for the table.\nvar symLock sync.RWMutex\n\n// NewSym2 constructs an interned symbol (or an expression keyword\n// if isKeyword is true on its first construction) for name.\nfunc NewSym2(name string, isKeyword bool) *Sym {\n\tsymLock.Lock()\n\tsym, ok := symbols[name]\n\tif !ok {\n\t\tsym = \u0026Sym{name, isKeyword}\n\t\tsymbols[name] = sym\n\t}\n\tsymLock.Unlock()\n\treturn sym\n}\n\n// IsInterned returns true if sym is interned.\nfunc (sym *Sym) IsInterned() bool {\n\tsymLock.RLock()\n\ts, ok := symbols[sym.Name]\n\tsymLock.RUnlock()\n\treturn ok \u0026\u0026 s == sym\n}\n\n// String returns a textual representation of sym.\nfunc (sym *Sym) String() string {\n\treturn sym.Name\n}\n\n// Defined symbols\n\nvar BackQuoteSym = NewSym(\"`\")\nvar CommaAtSym = NewSym(\",@\")\nvar CommaSym = NewSym(\",\")\nvar DotSym = NewSym(\".\")\nvar LeftParenSym = NewSym(\"(\")\nvar RightParenSym = NewSym(\")\")\nvar SingleQuoteSym = NewSym(\"''\")\n\nvar AppendSym = NewSym(\"append\")\nvar ConsSym = NewSym(\"cons\")\nvar ListSym = NewSym(\"list\")\nvar RestSym = NewSym(\"\u0026rest\")\nvar UnquoteSym = NewSym(\"unquote\")\nvar UnquoteSplicingSym = NewSym(\"unquote-splicing\")\n\n// Expression keywords\n\nvar CondSym = NewSym2(\"cond\", true)\nvar FutureSym = NewSym2(\"future\", true)\nvar LambdaSym = NewSym2(\"lambda\", true)\nvar MacroSym = NewSym2(\"macro\", true)\nvar ProgNSym = NewSym2(\"progn\", true)\nvar QuasiquoteSym = NewSym2(\"quasiquote\", true)\nvar QuoteSym = NewSym2(\"quote\", true)\nvar SetqSym = NewSym2(\"setq\", true)\n\n//----------------------------------------------------------------------\n\n// Func is a common base type of Lisp functions.\ntype Func struct {\n\t// Carity is a number of arguments, made negative if the func has \u0026rest.\n\tCarity int\n}\n\n// hasRest returns true if fn has \u0026rest.\nfunc (fn *Func) hasRest() bool {\n\treturn fn.Carity \u003c 0\n}\n\n// fixedArgs returns the number of fixed arguments.\nfunc (fn *Func) fixedArgs() int {\n\tif c := fn.Carity; c \u003c 0 {\n\t\treturn -c - 1\n\t} else {\n\t\treturn c\n\t}\n}\n\n// MakeFrame makes a call-frame from a list of actual arguments.\n// Argument x will be used instead of fn only in error messages.\nfunc (fn *Func) MakeFrame(arg *Cell, x interface{}) []interface{} {\n\tarity := fn.Carity // number of arguments, counting the whole rests as one\n\tif arity \u003c 0 {\n\t\tarity = -arity\n\t}\n\tframe := make([]interface{}, arity)\n\tn := fn.fixedArgs()\n\ti := 0\n\tfor i \u003c n \u0026\u0026 arg != Nil { // Set the list of fixed arguments.\n\t\tframe[i] = arg.Car\n\t\targ = arg.CdrCell()\n\t\ti++\n\t}\n\tif i != n || (arg != Nil \u0026\u0026 !fn.hasRest()) {\n\t\tpanic(NewEvalError(\"arity not matched\", x))\n\t}\n\tif fn.hasRest() {\n\t\tframe[n] = arg\n\t}\n\treturn frame\n}\n\n// EvalFrame evaluates each expression of frame with interp in env.\nfunc (fn *Func) EvalFrame(frame []interface{}, interp *Interp, env *Cell) {\n\tn := fn.fixedArgs()\n\tfor i := 0; i \u003c n; i++ {\n\t\tframe[i] = interp.Eval(frame[i], env)\n\t}\n\tif fn.hasRest() {\n\t\tif j, ok := frame[n].(*Cell); ok {\n\t\t\tz := Nil\n\t\t\ty := Nil\n\t\t\tfor j != Nil {\n\t\t\t\te := interp.Eval(j.Car, env)\n\t\t\t\tx := \u0026Cell{e, Nil}\n\t\t\t\tif z == Nil {\n\t\t\t\t\tz = x\n\t\t\t\t} else {\n\t\t\t\t\ty.Cdr = x\n\t\t\t\t}\n\t\t\t\ty = x\n\t\t\t\tj = j.CdrCell()\n\t\t\t}\n\t\t\tframe[n] = z\n\t\t}\n\t}\n}\n\n//----------------------------------------------------------------------\n\n// Macro represents a compiled macro expression.\ntype Macro struct {\n\tFunc\n\t// body is a list which will be used as the function body.\n\tbody *Cell\n}\n\n// NewMacro constructs a Macro.\nfunc NewMacro(carity int, body *Cell, env *Cell) interface{} {\n\treturn \u0026Macro{Func{carity}, body}\n}\n\n// ExpandWith expands the macro with a list of actual arguments.\nfunc (x *Macro) ExpandWith(interp *Interp, arg *Cell) interface{} {\n\tframe := x.MakeFrame(arg, x)\n\tenv := \u0026Cell{frame, Nil}\n\tvar y interface{} = Nil\n\tfor j := x.body; j != Nil; j = j.CdrCell() {\n\t\ty = interp.Eval(j.Car, env)\n\t}\n\treturn y\n}\n\n// String returns a textual representation of the macro.\nfunc (x *Macro) String() string {\n\treturn fmt.Sprintf(\"#\u003cmacro:%d:%s\u003e\", x.Carity, Str(x.body))\n}\n\n// Lambda represents a compiled lambda expression (within another function).\ntype Lambda struct {\n\tFunc\n\t// Body is a list which will be used as the function body.\n\tBody *Cell\n}\n\n// NewLambda constructs a Lambda.\nfunc NewLambda(carity int, body *Cell, env *Cell) interface{} {\n\treturn \u0026Lambda{Func{carity}, body}\n}\n\n// String returns a textual representation of the lambda.\nfunc (x *Lambda) String() string {\n\treturn fmt.Sprintf(\"#\u003clambda:%d:%s\u003e\", x.Carity, Str(x.Body))\n}\n\n// Closure represents a compiled lambda expression with its own environment.\ntype Closure struct {\n\tLambda\n\t// Env is the closure''s own environment.\n\tEnv *Cell\n}\n\n// NewClosure constructs a Closure.\nfunc NewClosure(carity int, body *Cell, env *Cell) interface{} {\n\treturn \u0026Closure{Lambda{Func{carity}, body}, env}\n}\n\n// MakeEnv makes a new environment from a list of acutual arguments,\n// which will be used in evaluation of the body of the closure.\nfunc (x *Closure) MakeEnv(interp *Interp, arg *Cell, interpEnv *Cell) *Cell {\n\tframe := x.MakeFrame(arg, x)\n\tx.EvalFrame(frame, interp, interpEnv)\n\treturn \u0026Cell{frame, x.Env} // Prepend the frame to Env of the closure.\n}\n\n// String returns a textual representation of the closure.\nfunc (x *Closure) String() string {\n\treturn fmt.Sprintf(\"#\u003cclosure:%d:%s:%s\u003e\",\n\t\tx.Carity, Str(x.Env), Str(x.Body))\n}\n\n//----------------------------------------------------------------------\n\n// BuiltInFunc represents a built-in function.\ntype BuiltInFunc struct {\n\tFunc\n\tname string\n\tbody func([]interface{}) interface{}\n}\n\n// NewBuiltInFunc constructs a BuiltInFunc.\nfunc NewBuiltInFunc(name string, carity int,\n\tbody func([]interface{}) interface{}) *BuiltInFunc {\n\treturn \u0026BuiltInFunc{Func{carity}, name, body}\n}\n\n// EvalWith invokes the built-in function with a list of actual arguments.\nfunc (x *BuiltInFunc) EvalWith(interp *Interp, arg *Cell,\n\tinterpEnv *Cell) interface{} {\n\tframe := x.MakeFrame(arg, x)\n\tx.EvalFrame(frame, interp, interpEnv)\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tif _, ok := err.(*EvalError); ok {\n\t\t\t\tpanic(err)\n\t\t\t} else {\n\t\t\t\tmsg := fmt.Sprintf(\"%v -- %s\", err, x.name)\n\t\t\t\tpanic(NewEvalError(msg, frame))\n\t\t\t}\n\t\t}\n\t}()\n\treturn x.body(frame)\n}\n\n// String returns a textual representation of the BuiltInFunc.\nfunc (x *BuiltInFunc) String() string {\n\treturn fmt.Sprintf(\"#\u003c%s:%d\u003e\", x.name, x.Carity)\n}\n\n//----------------------------------------------------------------------\n\n// Arg represents a bound variable in a compiled lambda/macro expression.\n// It is constructed with \u0026Arg{level, offset, symbol}.\ntype Arg struct {\n\t// Level is a nesting level of the lexical scope.\n\t// 0 for the innermost scope.\n\tLevel int\n\n\t// Offset is an offset of the variable within the frame of the Level.\n\t// 0 for the first variable within the frame.\n\tOffset int\n\n\t// Sym is a symbol which represented the variable before compilation.\n\tSymbol *Sym\n}\n\n// GetValue gets a value from the location corresponding to the variable x\n// within an environment env.\nfunc (x *Arg) GetValue(env *Cell) interface{} {\n\tfor i := 0; i \u003c x.Level; i++ {\n\t\tenv = env.Cdr.(*Cell)\n\t}\n\treturn (env.Car.([]interface{}))[x.Offset]\n}\n\n// SetValue sets a value y to the location corresponding to the variable x\n// within an environment env.\nfunc (x *Arg) SetValue(y interface{}, env *Cell) {\n\tfor i := 0; i \u003c x.Level; i++ {\n\t\tenv = env.Cdr.(*Cell)\n\t}\n\t(env.Car.([]interface{}))[x.Offset] = y\n}\n\n// String returns a textual representation of the Arg.\nfunc (x *Arg) String() string {\n\treturn fmt.Sprintf(\"#%d:%d:%v\", x.Level, x.Offset, x.Symbol)\n}\n\n//----------------------------------------------------------------------\n\n// EvalError represents an error in evaluation.\ntype EvalError struct {\n\tMessage string\n\tTrace []string\n}\n\n// NewEvalError constructs an EvalError.\nfunc NewEvalError(msg string, x interface{}) *EvalError {\n\treturn \u0026EvalError{msg + \": \" + Str(x), nil}\n}\n\n// NewNotVariableError constructs an EvalError which indicates an absence\n// of variable.\nfunc NewNotVariableError(x interface{}) *EvalError {\n\treturn NewEvalError(\"variable expected\", x)\n}\n\n// Error returns a textual representation of the error.\n// It is defined in compliance with the error type.\nfunc (err *EvalError) Error() string {\n\ts := \"EvalError: \" + err.Message\n\tfor _, line := range err.Trace {\n\t\ts += \"\\n\\t\" + line\n\t}\n\treturn s\n}\n\n// EofToken is a token which represents the end of file.\nvar EofToken error = errors.New(\"end of file\")\n\n//----------------------------------------------------------------------\n\n// Interp represents a core of the interpreter.\ntype Interp struct {\n\tglobals map[*Sym]interface{}\n\tlock sync.RWMutex\n}\n\n// Future represents a \"promise\" for future/force.\ntype Future struct {\n\t// Chan is a channel which transmits a pair of result and error.\n\t// The pair is represented by Cell.\n\tChan \u003c-chan Cell\n\n\t// Result is a pair of the result (in a narrow meaning) and the error.\n\tResult Cell\n\n\t// Lock is an exclusive lock to receive the result at \"force\".\n\tLock sync.Mutex\n}\n\n// String returns a textual representation of the Future.\nfunc (fu *Future) String() string {\n\treturn fmt.Sprintf(\"#\u003cfuture:%v:%s:%v\u003e\",\n\t\tfu.Chan, Str(\u0026fu.Result), \u0026fu.Lock)\n}\n\n// GetGlobalVar gets a global value of symbol sym within the interpreter.\nfunc (interp *Interp) GetGlobalVar(sym *Sym) (interface{}, bool) {\n\tinterp.lock.RLock()\n\tval, ok := interp.globals[sym]\n\tinterp.lock.RUnlock()\n\treturn val, ok\n}\n\n// SetGlobalVar sets a global value of symbol sym within the interpreter.\nfunc (interp *Interp) SetGlobalVar(sym *Sym, val interface{}) {\n\tinterp.lock.Lock()\n\tinterp.globals[sym] = val\n\tinterp.lock.Unlock()\n}\n\n// NewInterp constructs an interpreter and sets built-in functions etc. as\n// the global values of symbols within the interpreter.\nfunc NewInterp() *Interp {\n\tinterp := \u0026Interp{globals: make(map[*Sym]interface{})}\n\n\tinterp.Def(\"car\", 1, func(a []interface{}) interface{} {\n\t\tif a[0] == Nil {\n\t\t\treturn Nil\n\t\t}\n\t\treturn a[0].(*Cell).Car\n\t})\n\n\tinterp.Def(\"cdr\", 1, func(a []interface{}) interface{} {\n\t\tif a[0] == Nil {\n\t\t\treturn Nil\n\t\t}\n\t\treturn a[0].(*Cell).Cdr\n\t})\n\n\tinterp.Def(\"cons\", 2, func(a []interface{}) interface{} {\n\t\treturn \u0026Cell{a[0], a[1]}\n\t})\n\n\tinterp.Def(\"atom\", 1, func(a []interface{}) interface{} {\n\t\tif j, ok := a[0].(*Cell); ok \u0026\u0026 j != Nil {\n\t\t\treturn Nil\n\t\t}\n\t\treturn true\n\t})\n\n\tinterp.Def(\"eq\", 2, func(a []interface{}) interface{} {\n\t\tif a[0] == a[1] { // Cells are compared by address.\n\t\t\treturn true\n\t\t}\n\t\treturn Nil\n\t})\n\n\tinterp.Def(\"list\", -1, func(a []interface{}) interface{} {\n\t\treturn a[0]\n\t})\n\n\tinterp.Def(\"rplaca\", 2, func(a []interface{}) interface{} {\n\t\ta[0].(*Cell).Car = a[1]\n\t\treturn a[1]\n\t})\n\n\tinterp.Def(\"rplacd\", 2, func(a []interface{}) interface{} {\n\t\ta[0].(*Cell).Cdr = a[1]\n\t\treturn a[1]\n\t})\n\n\tinterp.Def(\"length\", 1, func(a []interface{}) interface{} {\n\t\tswitch x := a[0].(type) {\n\t\tcase *Cell:\n\t\t\treturn float64(x.Len())\n\t\tcase string: // Each multi-bytes character counts 1.\n\t\t\treturn float64(utf8.RuneCountInString(x))\n\t\tdefault:\n\t\t\tpanic(NewEvalError(\"list or string expected\", x))\n\t\t}\n\t})\n\n\tinterp.Def(\"stringp\", 1, func(a []interface{}) interface{} {\n\t\tif _, ok := a[0].(string); ok {\n\t\t\treturn true\n\t\t}\n\t\treturn Nil\n\t})\n\n\tinterp.Def(\"numberp\", 1, func(a []interface{}) interface{} {\n\t\tif _, ok := a[0].(float64); ok {\n\t\t\treturn true\n\t\t}\n\t\treturn Nil\n\t})\n\n\tinterp.Def(\"eql\", 2, func(a []interface{}) interface{} {\n\t\tif a[0] == a[1] { // Numbers are compared by value. See \"eq\".\n\t\t\treturn true\n\t\t}\n\t\treturn Nil\n\t})\n\n\tinterp.Def(\"\u003c\", 2, func(a []interface{}) interface{} {\n\t\tif a[0].(float64) \u003c a[1].(float64) {\n\t\t\treturn true\n\t\t}\n\t\treturn Nil\n\t})\n\n\tinterp.Def(\"%\", 2, func(a []interface{}) interface{} {\n\t\treturn math.Mod(a[0].(float64), a[1].(float64))\n\t})\n\n\tinterp.Def(\"mod\", 2, func(a []interface{}) interface{} {\n\t\tx, y := a[0].(float64), a[1].(float64)\n\t\tif (x \u003c 0 \u0026\u0026 y \u003e 0) || (x \u003e 0 \u0026\u0026 y \u003c 0) {\n\t\t\treturn math.Mod(x, y) + y\n\t\t}\n\t\treturn math.Mod(x, y)\n\t})\n\n\tinterp.Def(\"+\", -1, func(a []interface{}) interface{} {\n\t\treturn a[0].(*Cell).FoldL(0.0,\n\t\t\tfunc(x, y interface{}) interface{} {\n\t\t\t\treturn x.(float64) + y.(float64)\n\t\t\t})\n\t})\n\n\tinterp.Def(\"*\", -1, func(a []interface{}) interface{} {\n\t\treturn a[0].(*Cell).FoldL(1.0,\n\t\t\tfunc(x, y interface{}) interface{} {\n\t\t\t\treturn x.(float64) * y.(float64)\n\t\t\t})\n\t})\n\n\tinterp.Def(\"-\", -2, func(a []interface{}) interface{} {\n\t\tif a[1] == Nil {\n\t\t\treturn -a[0].(float64)\n\t\t} else {\n\t\t\treturn a[1].(*Cell).FoldL(a[0].(float64),\n\t\t\t\tfunc(x, y interface{}) interface{} {\n\t\t\t\t\treturn x.(float64) - y.(float64)\n\t\t\t\t})\n\t\t}\n\t})\n\n\tinterp.Def(\"/\", -3, func(a []interface{}) interface{} {\n\t\treturn a[2].(*Cell).FoldL(a[0].(float64)/a[1].(float64),\n\t\t\tfunc(x, y interface{}) interface{} {\n\t\t\t\treturn x.(float64) / y.(float64)\n\t\t\t})\n\t})\n\n\tinterp.Def(\"truncate\", -2, func(a []interface{}) interface{} {\n\t\tx, y := a[0].(float64), a[1].(*Cell)\n\t\tif y == Nil {\n\t\t\treturn math.Trunc(x)\n\t\t} else if y.Cdr == Nil {\n\t\t\treturn math.Trunc(x / y.Car.(float64))\n\t\t} else {\n\t\t\tpanic(\"one or two arguments expected\")\n\t\t}\n\t})\n\n\tinterp.Def(\"prin1\", 1, func(a []interface{}) interface{} {\n\t\tfmt.Print(Str2(a[0], true))\n\t\treturn a[0]\n\t})\n\n\tinterp.Def(\"princ\", 1, func(a []interface{}) interface{} {\n\t\tfmt.Print(Str2(a[0], false))\n\t\treturn a[0]\n\t})\n\n\tinterp.Def(\"terpri\", 0, func(a []interface{}) interface{} {\n\t\tfmt.Println()\n\t\treturn true\n\t})\n\n\tgensymCounterSym := NewSym(\"*gensym-counter*\")\n\tinterp.SetGlobalVar(gensymCounterSym, 1.0)\n\tinterp.Def(\"gensym\", 0, func(a []interface{}) interface{} {\n\t\tinterp.lock.Lock()\n\t\tdefer interp.lock.Unlock()\n\t\tx := interp.globals[gensymCounterSym].(float64)\n\t\tinterp.globals[gensymCounterSym] = x + 1.0\n\t\treturn \u0026Sym{fmt.Sprintf(\"G%d\", int(x)), false}\n\t})\n\n\tinterp.Def(\"make-symbol\", 1, func(a []interface{}) interface{} {\n\t\treturn \u0026Sym{a[0].(string), false}\n\t})\n\n\tinterp.Def(\"intern\", 1, func(a []interface{}) interface{} {\n\t\treturn NewSym(a[0].(string))\n\t})\n\n\tinterp.Def(\"symbol-name\", 1, func(a []interface{}) interface{} {\n\t\treturn a[0].(*Sym).Name\n\t})\n\n\tinterp.Def(\"apply\", 2, func(a []interface{}) interface{} {\n\t\targs := a[1].(*Cell).MapCar(QqQuote)\n\t\treturn interp.Eval(\u0026Cell{a[0], args}, Nil)\n\t})\n\n\tinterp.Def(\"exit\", 1, func(a []interface{}) interface{} {\n\t\tn := int(a[0].(float64))\n\t\tos.Exit(n)\n\t\treturn Nil // *not reached*\n\t})\n\n\tinterp.Def(\"dump\", 0, func(a []interface{}) interface{} {\n\t\tinterp.lock.RLock()\n\t\tdefer interp.lock.RUnlock()\n\t\tr := Nil\n\t\tfor key := range interp.globals {\n\t\t\tr = \u0026Cell{key, r}\n\t\t}\n\t\treturn r\n\t})\n\n\t// Wait until the \"promise\" of Future is delivered.\n\tinterp.Def(\"force\", 1, func(a []interface{}) interface{} {\n\t\tif fu, ok := a[0].(*Future); ok {\n\t\t\tfu.Lock.Lock()\n\t\t\tdefer fu.Lock.Unlock()\n\t\t\tif fu.Chan != nil {\n\t\t\t\tfu.Result = \u003c-fu.Chan\n\t\t\t\tfu.Chan = nil\n\t\t\t}\n\t\t\tif err := fu.Result.Cdr; err != nil {\n\t\t\t\tfu.Result.Cdr = nil\n\t\t\t\tpanic(err) // Transmit the error.\n\t\t\t}\n\t\t\treturn fu.Result.Car\n\t\t} else {\n\t\t\treturn a[0]\n\t\t}\n\t})\n\n\tinterp.SetGlobalVar(NewSym(\"*version*\"),\n\t\t\u0026Cell{\n\t\t\t1.42,\n\t\t\t\u0026Cell{\n\t\t\t\tfmt.Sprintf(\"%s %s/%s\",\n\t\t\t\t\truntime.Version(), runtime.GOOS, runtime.GOARCH),\n\t\t\t\t\u0026Cell{\n\t\t\t\t\t\"Nukata Lisp Light\",\n\t\t\t\t\tNil}}})\n\t// named after Nukata-gun (額田郡) in Tōkai-dō Mikawa-koku (東海道 三河国)\n\n\treturn interp\n}\n\n// Def defines a built-in function by giving a name, arity, and body.\nfunc (interp *Interp) Def(name string, carity int,\n\tbody func([]interface{}) interface{}) {\n\tsym := NewSym(name)\n\tfnc := NewBuiltInFunc(name, carity, body)\n\tinterp.SetGlobalVar(sym, fnc)\n}\n\n// Eval evaluates a Lisp expression in a given environment env.\nfunc (interp *Interp) Eval(expression interface{}, env *Cell) interface{} {\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tif ex, ok := err.(*EvalError); ok {\n\t\t\t\tif ex.Trace == nil {\n\t\t\t\t\tex.Trace = make([]string, 0, 10)\n\t\t\t\t}\n\t\t\t\tif len(ex.Trace) \u003c 10 {\n\t\t\t\t\tex.Trace = append(ex.Trace, Str(expression))\n\t\t\t\t}\n\t\t\t}\n\t\t\tpanic(err)\n\t\t}\n\t}()\n\tfor {\n\t\tswitch x := expression.(type) {\n\t\tcase *Arg:\n\t\t\treturn x.GetValue(env)\n\t\tcase *Sym:\n\t\t\tr, ok := interp.GetGlobalVar(x)\n\t\t\tif ok {\n\t\t\t\treturn r\n\t\t\t}\n\t\t\tpanic(NewEvalError(\"void variable\", x))\n\t\tcase *Cell:\n\t\t\tif x == Nil {\n\t\t\t\treturn x // an empty list\n\t\t\t}\n\t\t\tfn := x.Car\n\t\t\targ := x.CdrCell()\n\t\t\tsym, ok := fn.(*Sym)\n\t\t\tif ok \u0026\u0026 sym.IsKeyword {\n\t\t\t\tswitch sym {\n\t\t\t\tcase QuoteSym:\n\t\t\t\t\tif arg != Nil \u0026\u0026 arg.Cdr == Nil {\n\t\t\t\t\t\treturn arg.Car\n\t\t\t\t\t}\n\t\t\t\t\tpanic(NewEvalError(\"bad quote\", x))\n\t\t\t\tcase ProgNSym:\n\t\t\t\t\texpression = interp.evalProgN(arg, env)\n\t\t\t\tcase CondSym:\n\t\t\t\t\texpression = interp.evalCond(arg, env)\n\t\t\t\tcase SetqSym:\n\t\t\t\t\treturn interp.evalSetQ(arg, env)\n\t\t\t\tcase LambdaSym:\n\t\t\t\t\treturn interp.compile(arg, env, NewClosure)\n\t\t\t\tcase MacroSym:\n\t\t\t\t\tif env != Nil {\n\t\t\t\t\t\tpanic(NewEvalError(\"nested macro\", x))\n\t\t\t\t\t}\n\t\t\t\t\treturn interp.compile(arg, Nil, NewMacro)\n\t\t\t\tcase QuasiquoteSym:\n\t\t\t\t\tif arg != Nil \u0026\u0026 arg.Cdr == Nil {\n\t\t\t\t\t\texpression = QqExpand(arg.Car)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpanic(NewEvalError(\"bad quasiquote\", x))\n\t\t\t\t\t}\n\t\t\t\tcase FutureSym:\n\t\t\t\t\tch := make(chan Cell)\n\t\t\t\t\tgo interp.futureTask(arg, env, ch)\n\t\t\t\t\treturn \u0026Future{Chan: ch}\n\t\t\t\tdefault:\n\t\t\t\t\tpanic(NewEvalError(\"bad keyword\", fn))\n\t\t\t\t}\n\t\t\t} else { // Apply fn to arg.\n\t\t\t\t// Expand fn = interp.Eval(fn, env) here on Sym for speed.\n\t\t\t\tif ok {\n\t\t\t\t\tfn, ok = interp.GetGlobalVar(sym)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\tpanic(NewEvalError(\"undefined\", x.Car))\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfn = interp.Eval(fn, env)\n\t\t\t\t}\n\t\t\t\tswitch f := fn.(type) {\n\t\t\t\tcase *Closure:\n\t\t\t\t\tenv = f.MakeEnv(interp, arg, env)\n\t\t\t\t\texpression = interp.evalProgN(f.Body, env)\n\t\t\t\tcase *Macro:\n\t\t\t\t\texpression = f.ExpandWith(interp, arg)\n\t\t\t\tcase *BuiltInFunc:\n\t\t\t\t\treturn f.EvalWith(interp, arg, env)\n\t\t\t\tdefault:\n\t\t\t\t\tpanic(NewEvalError(\"not applicable\", fn))\n\t\t\t\t}\n\t\t\t}\n\t\tcase *Lambda:\n\t\t\treturn \u0026Closure{*x, env}\n\t\tdefault:\n\t\t\treturn x // numbers, strings etc.\n\t\t}\n\t}\n}\n\n// SafeEval evaluates a Lisp expression in a given environment env and\n// returns the result and nil.\n// If an error happens, it returns Nil and the error\nfunc (interp *Interp) SafeEval(expression interface{}, env *Cell) (\n\tresult interface{}, err interface{}) {\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\tresult, err = Nil, e\n\t\t}\n\t}()\n\treturn interp.Eval(expression, env), nil\n}\n\n// evalProgN evaluates E1, E2, .., E(n-1) and returns the tail expression En.\nfunc (interp *Interp) evalProgN(j *Cell, env *Cell) interface{} {\n\tif j == Nil {\n\t\treturn Nil\n\t}\n\tfor {\n\t\tx := j.Car\n\t\tj = j.CdrCell()\n\t\tif j == Nil {\n\t\t\treturn x // The tail expression will be evaluated at the caller.\n\t\t}\n\t\tinterp.Eval(x, env)\n\t}\n}\n\n// futureTask is a task for goroutine to deliver the \"promise\" of Future.\n// It returns the En value of (future E1 E2 .. En) via the channel and\n// closes the channel.\nfunc (interp *Interp) futureTask(j *Cell, env *Cell, ch chan\u003c- Cell) {\n\tdefer close(ch)\n\tresult, err := interp.safeProgN(j, env)\n\tch \u003c- Cell{result, err}\n}\n\n// safeProgN evaluates E1, E2, .. En and returns the value of En and nil.\n// If an error happens, it returns Nil and the error.\nfunc (interp *Interp) safeProgN(j *Cell, env *Cell) (result interface{},\n\terr interface{}) {\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\tresult, err = Nil, e\n\t\t}\n\t}()\n\tx := interp.evalProgN(j, env)\n\treturn interp.Eval(x, env), nil\n}\n\n// evalCond evaluates a conditional expression and returns the selection\n// unevaluated.\nfunc (interp *Interp) evalCond(j *Cell, env *Cell) interface{} {\n\tfor j != Nil {\n\t\tclause, ok := j.Car.(*Cell)\n\t\tif ok {\n\t\t\tif clause != Nil {\n\t\t\t\tresult := interp.Eval(clause.Car, env)\n\t\t\t\tif result != Nil { // If the condition holds...\n\t\t\t\t\tbody := clause.CdrCell()\n\t\t\t\t\tif body == Nil {\n\t\t\t\t\t\treturn QqQuote(result)\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn interp.evalProgN(body, env)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tpanic(NewEvalError(\"cond test expected\", j.Car))\n\t\t}\n\t\tj = j.CdrCell()\n\t}\n\treturn Nil // No clause holds.\n}\n\n// evalSeqQ evaluates each Ei of (setq .. Vi Ei ..) and assigns it to Vi\n// repectively. It returns the value of the last expression En.\nfunc (interp *Interp) evalSetQ(j *Cell, env *Cell) interface{} {\n\tvar result interface{} = Nil\n\tfor j != Nil {\n\t\tlval := j.Car\n\t\tj = j.CdrCell()\n\t\tif j == Nil {\n\t\t\tpanic(NewEvalError(\"right value expected\", lval))\n\t\t}\n\t\tresult = interp.Eval(j.Car, env)\n\t\tswitch v := lval.(type) {\n\t\tcase *Arg:\n\t\t\tv.SetValue(result, env)\n\t\tcase *Sym:\n\t\t\tif v.IsKeyword {\n\t\t\t\tpanic(NewNotVariableError(lval))\n\t\t\t}\n\t\t\tinterp.SetGlobalVar(v, result)\n\t\tdefault:\n\t\t\tpanic(NewNotVariableError(lval))\n\t\t}\n\t\tj = j.CdrCell()\n\t}\n\treturn result\n}\n\n// compile compiles a Lisp list (macro ...) or (lambda ...).\nfunc (interp *Interp) compile(arg *Cell, env *Cell,\n\tfactory func(int, *Cell, *Cell) interface{}) interface{} {\n\tif arg == Nil {\n\t\tpanic(NewEvalError(\"arglist and body expected\", arg))\n\t}\n\ttable := make(map[*Sym]*Arg)\n\thasRest := makeArgTable(arg.Car, table)\n\tarity := len(table)\n\tbody := arg.CdrCell()\n\tbody = scanForArgs(body, table).(*Cell)\n\tbody = interp.expandMacros(body, 20).(*Cell) // Expand up to 20 nestings.\n\tbody = interp.compileInners(body).(*Cell)\n\tif hasRest {\n\t\tarity = -arity\n\t}\n\treturn factory(arity, body, env)\n}\n\n// expandMacros expands macros and quasi-quotes in x up to count nestings.\nfunc (interp *Interp) expandMacros(x interface{}, count int) interface{} {\n\tif count \u003e 0 {\n\t\tif j, ok := x.(*Cell); ok {\n\t\t\tif j == Nil {\n\t\t\t\treturn Nil\n\t\t\t}\n\t\t\tswitch k := j.Car; k {\n\t\t\tcase QuoteSym, LambdaSym, MacroSym:\n\t\t\t\treturn j\n\t\t\tcase QuasiquoteSym:\n\t\t\t\td := j.CdrCell()\n\t\t\t\tif d != Nil \u0026\u0026 d.Cdr == Nil {\n\t\t\t\t\tz := QqExpand(d.Car)\n\t\t\t\t\treturn interp.expandMacros(z, count)\n\t\t\t\t}\n\t\t\t\tpanic(NewEvalError(\"bad quasiquote\", j))\n\t\t\tdefault:\n\t\t\t\tif sym, ok := k.(*Sym); ok {\n\t\t\t\t\tif v, ok := interp.GetGlobalVar(sym); ok {\n\t\t\t\t\t\tk = v\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif f, ok := k.(*Macro); ok {\n\t\t\t\t\td := j.CdrCell()\n\t\t\t\t\tz := f.ExpandWith(interp, d)\n\t\t\t\t\treturn interp.expandMacros(z, count-1)\n\t\t\t\t} else {\n\t\t\t\t\treturn j.MapCar(func(y interface{}) interface{} {\n\t\t\t\t\t\treturn interp.expandMacros(y, count)\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn x\n}\n\n// compileInners replaces inner lambda-expressions with Lambda instances.\nfunc (interp *Interp) compileInners(x interface{}) interface{} {\n\tif j, ok := x.(*Cell); ok {\n\t\tif j == Nil {\n\t\t\treturn Nil\n\t\t}\n\t\tswitch k := j.Car; k {\n\t\tcase QuoteSym:\n\t\t\treturn j\n\t\tcase LambdaSym:\n\t\t\td := j.CdrCell()\n\t\t\treturn interp.compile(d, Nil, NewLambda)\n\t\tcase MacroSym:\n\t\t\tpanic(NewEvalError(\"nested macro\", j))\n\t\tdefault:\n\t\t\treturn j.MapCar(func(y interface{}) interface{} {\n\t\t\t\treturn interp.compileInners(y)\n\t\t\t})\n\t\t}\n\t}\n\treturn x\n}\n\n//----------------------------------------------------------------------\n\n// makeArgTable makes an argument-table. It returns true if x has \u0026rest.\nfunc makeArgTable(x interface{}, table map[*Sym]*Arg) bool {\n\targ, ok := x.(*Cell)\n\tif !ok {\n\t\tpanic(NewEvalError(\"arglist expected\", x))\n\t}\n\tif arg == Nil {\n\t\treturn false\n\t} else {\n\t\toffset := 0 // offset value within the call-frame\n\t\thasRest := false\n\t\tfor arg != Nil {\n\t\t\tj := arg.Car\n\t\t\tif hasRest {\n\t\t\t\tpanic(NewEvalError(\"2nd rest\", j))\n\t\t\t}\n\t\t\tif j == RestSym { // \u0026rest var\n\t\t\t\targ = arg.CdrCell()\n\t\t\t\tif arg == Nil {\n\t\t\t\t\tpanic(NewNotVariableError(arg))\n\t\t\t\t}\n\t\t\t\tj = arg.Car\n\t\t\t\tif j == RestSym {\n\t\t\t\t\tpanic(NewNotVariableError(j))\n\t\t\t\t}\n\t\t\t\thasRest = true\n\t\t\t}\n\t\t\tvar sym *Sym\n\t\t\tswitch v := j.(type) {\n\t\t\tcase *Sym:\n\t\t\t\tsym = v\n\t\t\tcase *Arg:\n\t\t\t\tsym = v.Symbol\n\t\t\tdefault:\n\t\t\t\tpanic(NewNotVariableError(j))\n\t\t\t}\n\t\t\tif _, ok := table[sym]; ok {\n\t\t\t\tpanic(NewEvalError(\"duplicated argument name\", sym))\n\t\t\t}\n\t\t\ttable[sym] = \u0026Arg{0, offset, sym}\n\t\t\toffset++\n\t\t\targ = arg.CdrCell()\n\t\t}\n\t\treturn hasRest\n\t}\n}\n\n// scanForArgs scans x for formal arguments in table and replaces them\n// with Args.\n// Also it scans x for free Args not in table and promotes their levels.\nfunc scanForArgs(x interface{}, table map[*Sym]*Arg) interface{} {\n\tswitch j := x.(type) {\n\tcase *Sym:\n\t\tif a, ok := table[j]; ok {\n\t\t\treturn a\n\t\t}\n\t\treturn j\n\tcase *Arg:\n\t\tif a, ok := table[j.Symbol]; ok {\n\t\t\treturn a\n\t\t}\n\t\treturn \u0026Arg{j.Level + 1, j.Offset, j.Symbol}\n\tcase *Cell:\n\t\tif j == Nil {\n\t\t\treturn Nil\n\t\t}\n\t\tswitch j.Car {\n\t\tcase QuoteSym:\n\t\t\treturn j\n\t\tcase QuasiquoteSym:\n\t\t\treturn \u0026Cell{QuasiquoteSym, scanForQQ(j.Cdr, table, 0)}\n\t\tdefault:\n\t\t\treturn j.MapCar(func(y interface{}) interface{} {\n\t\t\t\treturn scanForArgs(y, table)\n\t\t\t})\n\t\t}\n\tdefault:\n\t\treturn j\n\t}\n}\n\n// scanForQQ scans x for quasi-quotes and executes scanForArgs on the\n// nesting level of quotes.\nfunc scanForQQ(x interface{}, table map[*Sym]*Arg,\n\tlevel int) interface{} {\n\tj, ok := x.(*Cell)\n\tif ok {\n\t\tif j == Nil {\n\t\t\treturn Nil\n\t\t}\n\t\tswitch k := j.Car; k {\n\t\tcase QuasiquoteSym:\n\t\t\treturn \u0026Cell{k, scanForQQ(j.Cdr, table, level+1)}\n\t\tcase UnquoteSym, UnquoteSplicingSym:\n\t\t\tvar d interface{}\n\t\t\tif level == 0 {\n\t\t\t\td = scanForArgs(j.Cdr, table)\n\t\t\t} else {\n\t\t\t\td = scanForQQ(j.Cdr, table, level-1)\n\t\t\t}\n\t\t\tif d == j.Cdr {\n\t\t\t\treturn j\n\t\t\t}\n\t\t\treturn \u0026Cell{k, d}\n\t\tdefault:\n\t\t\treturn j.MapCar(func(y interface{}) interface{} {\n\t\t\t\treturn scanForQQ(y, table, level)\n\t\t\t})\n\t\t}\n\t} else {\n\t\treturn x\n\t}\n}\n\n//----------------------------------------------------------------------\n// Quasi-Quotation\n\n// QqExpand expands x of any quasi-quote `x into the equivalent S-expression.\nfunc QqExpand(x interface{}) interface{} {\n\treturn qqExpand0(x, 0) // Begin with the nesting level 0.\n}\n\n// QqQuote quotes x so that the result evaluates to x.\nfunc QqQuote(x interface{}) interface{} {\n\tif x == Nil {\n\t\treturn Nil\n\t}\n\tswitch x.(type) {\n\tcase *Sym, *Cell:\n\t\treturn \u0026Cell{QuoteSym, \u0026Cell{x, Nil}}\n\tdefault:\n\t\treturn x\n\t}\n}\n\nfunc qqExpand0(x interface{}, level int) interface{} {\n\tif j, ok := x.(*Cell); ok {\n\t\tif j == Nil {\n\t\t\treturn Nil\n\t\t}\n\t\tif j.Car == UnquoteSym { // ,a\n\t\t\tif level == 0 {\n\t\t\t\treturn j.CdrCell().Car // ,a =\u003e a\n\t\t\t}\n\t\t}\n\t\tt := qqExpand1(j, level)\n\t\tif t.Cdr == Nil {\n\t\t\tif k, ok := t.Car.(*Cell); ok {\n\t\t\t\tif k.Car == ListSym || k.Car == ConsSym {\n\t\t\t\t\treturn k\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn \u0026Cell{AppendSym, t}\n\t} else {\n\t\treturn QqQuote(x)\n\t}\n}\n\n// qqExpand1 expands x of `x so that the result can be used as an argument of\n// append. Example 1: (,a b) =\u003e ((list a ''b))\n// Example 2: (,a ,@(cons 2 3)) =\u003e ((cons a (cons 2 3)))\nfunc qqExpand1(x interface{}, level int) *Cell {\n\tif j, ok := x.(*Cell); ok {\n\t\tif j == Nil {\n\t\t\treturn \u0026Cell{Nil, Nil}\n\t\t}\n\t\tswitch j.Car {\n\t\tcase UnquoteSym: // ,a\n\t\t\tif level == 0 {\n\t\t\t\treturn j.CdrCell() // ,a =\u003e (a)\n\t\t\t}\n\t\t\tlevel--\n\t\tcase QuasiquoteSym: // `a\n\t\t\tlevel++\n\t\t}\n\t\th := qqExpand2(j.Car, level)\n\t\tt := qqExpand1(j.Cdr, level) // != Nil\n\t\tif t.Car == Nil \u0026\u0026 t.Cdr == Nil {\n\t\t\treturn \u0026Cell{h, Nil}\n\t\t} else if hc, ok := h.(*Cell); ok {\n\t\t\tif hc.Car == ListSym {\n\t\t\t\tif tcar, ok := t.Car.(*Cell); ok {\n\t\t\t\t\tif tcar.Car == ListSym {\n\t\t\t\t\t\thh := qqConcat(hc, tcar.Cdr)\n\t\t\t\t\t\treturn \u0026Cell{hh, t.Cdr}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif hcdr, ok := hc.Cdr.(*Cell); ok {\n\t\t\t\t\thh := qqConsCons(hcdr, t.Car)\n\t\t\t\t\treturn \u0026Cell{hh, t.Cdr}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn \u0026Cell{h, t}\n\t} else {\n\t\treturn \u0026Cell{QqQuote(x), Nil}\n\t}\n}\n\n// (1 2), (3 4) =\u003e (1 2 3 4)\nfunc qqConcat(x *Cell, y interface{}) interface{} {\n\tif x == Nil {\n\t\treturn y\n\t} else {\n\t\treturn \u0026Cell{x.Car, qqConcat(x.CdrCell(), y)}\n\t}\n}\n\n// (1 2 3), \"a\" =\u003e (cons 1 (cons 2 (cons 3 \"a\")))\nfunc qqConsCons(x *Cell, y interface{}) interface{} {\n\tif x == Nil {\n\t\treturn y\n\t} else {\n\t\treturn \u0026Cell{ConsSym, \u0026Cell{x.Car,\n\t\t\t\u0026Cell{qqConsCons(x.CdrCell(), y), Nil}}}\n\t}\n}\n\n// qqExpand2 expands x.car (= y) of `x so that the result can be used as an\n// argument of append.\n// Examples: ,a =\u003e (list a); ,@(foo 1 2) =\u003e (foo 1 2); b =\u003e (list ''b)\nfunc qqExpand2(y interface{}, level int) interface{} {\n\tif j, ok := y.(*Cell); ok {\n\t\tif j == Nil {\n\t\t\treturn \u0026Cell{ListSym, \u0026Cell{Nil, Nil}} // (list nil)\n\t\t}\n\t\tswitch j.Car {\n\t\tcase UnquoteSym: // ,a\n\t\t\tif level == 0 {\n\t\t\t\treturn \u0026Cell{ListSym, j.Cdr} // ,a =\u003e (list a)\n\t\t\t}\n\t\t\tlevel--\n\t\tcase UnquoteSplicingSym: // ,@a\n\t\t\tif level == 0 {\n\t\t\t\treturn j.CdrCell().Car // ,@a =\u003e a\n\t\t\t}\n\t\t\tlevel--\n\t\tcase QuasiquoteSym: // `a\n\t\t\tlevel++\n\t\t}\n\t}\n\treturn \u0026Cell{ListSym, \u0026Cell{qqExpand0(y, level), Nil}}\n}\n\n//----------------------------------------------------------------------\n\n// Reader represents a reader of Lisp expressions.\ntype Reader struct {\n\tscanner *bufio.Scanner\n\ttoken interface{} // the current token\n\ttokens []string // tokens read from the current line\n\tindex int // the next index of tokens\n\tline string // the current line\n\tlineNo int // the current line number\n\terred bool // a flag if an error has happened\n}\n\n// NewReader constructs a reader which will read Lisp expressions from r.\nfunc NewReader(r io.Reader) *Reader {\n\tscanner := bufio.NewScanner(r)\n\treturn \u0026Reader{scanner, nil, nil, 0, \"\", 0, false}\n}\n\n// Read reads a Lisp expression and returns the expression and nil.\n// If the input runs out, it returns EofToken and nil.\n// If an error happens, it returns Nil and the error.\nfunc (rr *Reader) Read() (result interface{}, err interface{}) {\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\tresult, err = Nil, e\n\t\t}\n\t}()\n\trr.readToken()\n\treturn rr.parseExpression(), nil\n}\n\nfunc (rr *Reader) newSynatxError(msg string, arg interface{}) *EvalError {\n\trr.erred = true\n\ts := fmt.Sprintf(\"syntax error: %s -- %d: %s\",\n\t\tfmt.Sprintf(msg, arg), rr.lineNo, rr.line)\n\treturn \u0026EvalError{s, nil}\n}\n\nfunc (rr *Reader) parseExpression() interface{} {\n\tswitch rr.token {\n\tcase LeftParenSym: // (a b c)\n\t\trr.readToken()\n\t\treturn rr.parseListBody()\n\tcase SingleQuoteSym: // ''a =\u003e (quote a)\n\t\trr.readToken()\n\t\treturn \u0026Cell{QuoteSym, \u0026Cell{rr.parseExpression(), Nil}}\n\tcase BackQuoteSym: // `a =\u003e (quasiquote a)\n\t\trr.readToken()\n\t\treturn \u0026Cell{QuasiquoteSym, \u0026Cell{rr.parseExpression(), Nil}}\n\tcase CommaSym: // ,a =\u003e (unquote a)\n\t\trr.readToken()\n\t\treturn \u0026Cell{UnquoteSym, \u0026Cell{rr.parseExpression(), Nil}}\n\tcase CommaAtSym: // ,@a =\u003e (unquote-splicing a)\n\t\trr.readToken()\n\t\treturn \u0026Cell{UnquoteSplicingSym, \u0026Cell{rr.parseExpression(), Nil}}\n\tcase DotSym, RightParenSym:\n\t\tpanic(rr.newSynatxError(\"unexpected \\\"%v\\\"\", rr.token))\n\tdefault:\n\t\treturn rr.token\n\t}\n}\n\nfunc (rr *Reader) parseListBody() *Cell {\n\tif rr.token == EofToken {\n\t\tpanic(rr.newSynatxError(\"unexpected EOF%s\", \"\"))\n\t} else if rr.token == RightParenSym {\n\t\treturn Nil\n\t} else {\n\t\te1 := rr.parseExpression()\n\t\trr.readToken()\n\t\tvar e2 interface{}\n\t\tif rr.token == DotSym { // (a . b)\n\t\t\trr.readToken()\n\t\t\te2 = rr.parseExpression()\n\t\t\trr.readToken()\n\t\t\tif rr.token != RightParenSym {\n\t\t\t\tpanic(rr.newSynatxError(\"\\\")\\\" expected: %v\", rr.token))\n\t\t\t}\n\t\t} else {\n\t\t\te2 = rr.parseListBody()\n\t\t}\n\t\treturn \u0026Cell{e1, e2}\n\t}\n}\n\n// readToken reads the next token and set it to rr.token.\nfunc (rr *Reader) readToken() {\n\t// Read the next line if the line ends or an error happened last time.\n\tfor len(rr.tokens) \u003c= rr.index || rr.erred {\n\t\trr.erred = false\n\t\tif rr.scanner.Scan() {\n\t\t\trr.line = rr.scanner.Text()\n\t\t\trr.lineNo++\n\t\t} else {\n\t\t\tif err := rr.scanner.Err(); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\trr.token = EofToken\n\t\t\treturn\n\t\t}\n\t\tmm := tokenPat.FindAllStringSubmatch(rr.line, -1)\n\t\ttt := make([]string, 0, len(mm)*3/5) // Estimate 40% will be spaces.\n\t\tfor _, m := range mm {\n\t\t\tif m[1] != \"\" {\n\t\t\t\ttt = append(tt, m[1])\n\t\t\t}\n\t\t}\n\t\trr.tokens = tt\n\t\trr.index = 0\n\t}\n\t// Read the next token.\n\ts := rr.tokens[rr.index]\n\trr.index++\n\tif s[0] == ''\"'' {\n\t\tn := len(s) - 1\n\t\tif n \u003c 1 || s[n] != ''\"'' {\n\t\t\tpanic(rr.newSynatxError(\"bad string: ''%s''\", s))\n\t\t}\n\t\ts = s[1:n]\n\t\ts = escapePat.ReplaceAllStringFunc(s, func(t string) string {\n\t\t\tr, ok := escapes[t] // r, err := strconv.Unquote(\"''\" + t + \"''\")\n\t\t\tif !ok {\n\t\t\t\tr = t // Leave any invalid escape sequence as it is.\n\t\t\t}\n\t\t\treturn r\n\t\t})\n\t\trr.token = s\n\t\treturn\n\t}\n\tf, err := strconv.ParseFloat(s, 64) // Try to read s as a float64.\n\tif err == nil {\n\t\trr.token = f\n\t\treturn\n\t}\n\tif s == \"nil\" {\n\t\trr.token = Nil\n\t\treturn\n\t} else if s == \"t\" {\n\t\trr.token = true\n\t\treturn\n\t}\n\trr.token = NewSym(s)\n\treturn\n}\n\n// tokenPat is a regular expression to split a line to Lisp tokens.\nvar tokenPat = regexp.MustCompile(`\\s+|;.*$|(\"(\\\\.?|.)*?\"|,@?|[^()''` +\n\t\"`\" + `~\"; \\t]+|.)`)\n\n// escapePat is a reg. expression to take an escape sequence out of a string.\nvar escapePat = regexp.MustCompile(`\\\\(.)`)\n\n// escapes is a mapping from an escape sequence to its string value.\nvar escapes = map[string]string{\n\t`\\\\`: `\\`,\n\t`\\\"`: `\"`,\n\t`\\n`: \"\\n\", `\\r`: \"\\r\", `\\f`: \"\\f\", `\\b`: \"\\b\", `\\t`: \"\\t\", `\\v`: \"\\v\",\n}\n\n//----------------------------------------------------------------------\n\n// Str returns a textual representation of any Lisp expression x.\nfunc Str(x interface{}) string {\n\treturn Str2(x, true)\n}\n\n// Str2 returns a textual representation of any Lisp expression x.\n// If quoteString is true, any strings in the expression are represented\n// with enclosing quotes respectively.\nfunc Str2(x interface{}, quoteString bool) string {\n\treturn str4(x, quoteString, -1, nil)\n}\n\n// quotes is a mapping from a quote symbol to its string representation.\nvar quotes = map[*Sym]string{\n\tQuoteSym: \"''\",\n\tQuasiquoteSym: \"`\",\n\tUnquoteSym: \",\",\n\tUnquoteSplicingSym: \",@\",\n}\n\nfunc str4(a interface{}, quoteString bool, count int,\n\tprinted map[*Cell]bool) string {\n\tif a == true {\n\t\treturn \"t\"\n\t}\n\tswitch x := a.(type) {\n\tcase *Cell:\n\t\tif x == Nil {\n\t\t\treturn \"nil\"\n\t\t}\n\t\tif s, ok := x.Car.(*Sym); ok {\n\t\t\tif q, ok := quotes[s]; ok {\n\t\t\t\tif d, ok := x.Cdr.(*Cell); ok {\n\t\t\t\t\tif d.Cdr == Nil {\n\t\t\t\t\t\treturn q + str4(d.Car, true, count, printed)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn \"(\" + strListBody(x, count, printed) + \")\"\n\tcase string:\n\t\tif quoteString {\n\t\t\treturn strconv.Quote(x)\n\t\t}\n\t\treturn x\n\tcase []interface{}:\n\t\ts := make([]string, len(x))\n\t\tfor i, e := range x {\n\t\t\ts[i] = str4(e, true, count, printed)\n\t\t}\n\t\treturn \"[\" + strings.Join(s, \", \") + \"]\"\n\tcase *Sym:\n\t\tif x.IsInterned() {\n\t\t\treturn x.Name\n\t\t}\n\t\treturn \"#:\" + x.Name\n\t}\n\treturn fmt.Sprintf(\"%v\", a)\n}\n\n// strListBody makes a string representation of a list, omitting its parens.\nfunc strListBody(x *Cell, count int, printed map[*Cell]bool) string {\n\tif printed == nil {\n\t\tprinted = make(map[*Cell]bool)\n\t}\n\tif count \u003c 0 {\n\t\tcount = 4 // threshold of ellipsis for circular lists\n\t}\n\ts := make([]string, 0, 10)\n\ty := x\n\tfor y != Nil {\n\t\tif _, ok := printed[y]; ok {\n\t\t\tcount--\n\t\t\tif count \u003c 0 {\n\t\t\t\ts = append(s, \"...\") // ellipsis for a circular list\n\t\t\t\treturn strings.Join(s, \" \")\n\t\t\t}\n\t\t} else {\n\t\t\tprinted[y] = true\n\t\t\tcount = 4\n\t\t}\n\t\ts = append(s, str4(y.Car, true, count, printed))\n\t\tif cdr, ok := y.Cdr.(*Cell); ok {\n\t\t\ty = cdr\n\t\t} else {\n\t\t\ts = append(s, \".\")\n\t\t\ts = append(s, str4(y.Cdr, true, count, printed))\n\t\t\tbreak\n\t\t}\n\t}\n\ty = x\n\tfor y != Nil {\n\t\tdelete(printed, y)\n\t\tif cdr, ok := y.Cdr.(*Cell); ok {\n\t\t\ty = cdr\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn strings.Join(s, \" \")\n}\n\n//----------------------------------------------------------------------\n\n// Run executes REPL (Read-Eval-Print Loop).\n// It returns false if REPL was ceased by an error.\n// It returns true if REPL was finished normally.\nfunc Run(interp *Interp, input io.Reader) bool {\n\tinteractive := (input == nil)\n\tif interactive {\n\t\tinput = os.Stdin\n\t}\n\treader := NewReader(input)\n\tfor {\n\t\tif interactive {\n\t\t\tos.Stdout.WriteString(\"\u003e \")\n\t\t}\n\t\tx, err := reader.Read()\n\t\tif err == nil {\n\t\t\tif x == EofToken {\n\t\t\t\treturn true // Finished normally.\n\t\t\t}\n\t\t\tx, err = interp.SafeEval(x, Nil)\n\t\t\tif err == nil {\n\t\t\t\tif interactive {\n\t\t\t\t\tfmt.Println(Str(x))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tif !interactive {\n\t\t\t\treturn false // Ceased by an error.\n\t\t\t}\n\t\t}\n\t}\n}\n\n// Main runs each element of args as a name of Lisp script file.\n// It ignores args[0].\n// If it does not have args[1] or some element is \"-\", it begins REPL.\nfunc Main(args []string) int {\n\tinterp := NewInterp()\n\tss := strings.NewReader(Prelude)\n\tif !Run(interp, ss) {\n\t\treturn 1\n\t}\n\tif len(args) \u003c 2 {\n\t\targs = []string{args[0], \"-\"}\n\t}\n\tfor i, fileName := range args {\n\t\tif i == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif fileName == \"-\" {\n\t\t\tRun(interp, nil)\n\t\t\tfmt.Println(\"Goodbye\")\n\t\t} else {\n\t\t\tfile, err := os.Open(fileName)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn 1\n\t\t\t}\n\t\t\tif !Run(interp, file) {\n\t\t\t\treturn 1\n\t\t\t}\n\t\t}\n\t}\n\treturn 0\n}\n\nfunc main() {\n\tos.Exit(Main(os.Args))\n}\n\n// Prelude is an initialization script of Lisp.\n// Each \"~\" is replaced by \"`\" at runtime.\nvar Prelude = strings.Replace(`\n(setq defmacro\n (macro (name args \u0026rest body)\n ~(progn (setq ,name (macro ,args ,@body))\n '',name)))\n\n(defmacro defun (name args \u0026rest body)\n ~(progn (setq ,name (lambda ,args ,@body))\n '',name))\n\n(defun caar (x) (car (car x)))\n(defun cadr (x) (car (cdr x)))\n(defun cdar (x) (cdr (car x)))\n(defun cddr (x) (cdr (cdr x)))\n(defun caaar (x) (car (car (car x))))\n(defun caadr (x) (car (car (cdr x))))\n(defun cadar (x) (car (cdr (car x))))\n(defun caddr (x) (car (cdr (cdr x))))\n(defun cdaar (x) (cdr (car (car x))))\n(defun cdadr (x) (cdr (car (cdr x))))\n(defun cddar (x) (cdr (cdr (car x))))\n(defun cdddr (x) (cdr (cdr (cdr x))))\n(defun not (x) (eq x nil))\n(defun consp (x) (not (atom x)))\n(defun print (x) (prin1 x) (terpri) x)\n(defun identity (x) x)\n\n(setq\n = eql\n null not\n setcar rplaca\n setcdr rplacd)\n\n(defun \u003e (x y) (\u003c y x))\n(defun \u003e= (x y) (not (\u003c x y)))\n(defun \u003c= (x y) (not (\u003c y x)))\n(defun /= (x y) (not (= x y)))\n\n(defun equal (x y)\n (cond ((atom x) (eql x y))\n ((atom y) nil)\n ((equal (car x) (car y)) (equal (cdr x) (cdr y)))))\n\n(defmacro if (test then \u0026rest else)\n ~(cond (,test ,then)\n ,@(cond (else ~((t ,@else))))))\n\n(defmacro when (test \u0026rest body)\n ~(cond (,test ,@body)))\n\n(defmacro let (args \u0026rest body)\n ((lambda (vars vals)\n (defun vars (x)\n (cond (x (cons (if (atom (car x))\n (car x)\n (caar x))\n (vars (cdr x))))))\n (defun vals (x)\n (cond (x (cons (if (atom (car x))\n nil\n (cadar x))\n (vals (cdr x))))))\n ~((lambda ,(vars args) ,@body) ,@(vals args)))\n nil nil))\n\n(defmacro letrec (args \u0026rest body) ; (letrec ((v e) ...) body...)\n (let (vars setqs)\n (defun vars (x)\n (cond (x (cons (caar x)\n (vars (cdr x))))))\n (defun sets (x)\n (cond (x (cons ~(setq ,(caar x) ,(cadar x))\n (sets (cdr x))))))\n ~(let ,(vars args) ,@(sets args) ,@body)))\n\n(defun _append (x y)\n (if (null x)\n y\n (cons (car x) (_append (cdr x) y))))\n(defmacro append (x \u0026rest y)\n (if (null y)\n x\n ~(_append ,x (append ,@y))))\n\n(defmacro and (x \u0026rest y)\n (if (null y)\n x\n ~(cond (,x (and ,@y)))))\n\n(defun mapcar (f x)\n (and x (cons (f (car x)) (mapcar f (cdr x)))))\n\n(defmacro or (x \u0026rest y)\n (if (null y)\n x\n ~(cond (,x)\n ((or ,@y)))))\n\n(defun listp (x)\n (or (null x) (consp x))) ; NB (listp (lambda (x) (+ x 1))) =\u003e nil\n\n(defun memq (key x)\n (cond ((null x) nil)\n ((eq key (car x)) x)\n (t (memq key (cdr x)))))\n\n(defun member (key x)\n (cond ((null x) nil)\n ((equal key (car x)) x)\n (t (member key (cdr x)))))\n\n(defun assq (key alist)\n (cond (alist (let ((e (car alist)))\n (if (and (consp e) (eq key (car e)))\n e\n (assq key (cdr alist)))))))\n\n(defun assoc (key alist)\n (cond (alist (let ((e (car alist)))\n (if (and (consp e) (equal key (car e)))\n e\n (assoc key (cdr alist)))))))\n\n(defun _nreverse (x prev)\n (let ((next (cdr x)))\n (setcdr x prev)\n (if (null next)\n x\n (_nreverse next x))))\n(defun nreverse (list) ; (nreverse ''(a b c d)) =\u003e (d c b a)\n (cond (list (_nreverse list nil))))\n\n(defun last (list)\n (if (atom (cdr list))\n list\n (last (cdr list))))\n\n(defun nconc (\u0026rest lists)\n (if (null (cdr lists))\n (car lists)\n (if (null (car lists))\n (apply nconc (cdr lists))\n (setcdr (last (car lists))\n (apply nconc (cdr lists)))\n (car lists))))\n\n(defmacro while (test \u0026rest body)\n (let ((loop (gensym)))\n ~(letrec ((,loop (lambda () (cond (,test ,@body (,loop))))))\n (,loop))))\n\n(defmacro dolist (spec \u0026rest body) ; (dolist (name list [result]) body...)\n (let ((name (car spec))\n (list (gensym)))\n ~(let (,name\n (,list ,(cadr spec)))\n (while ,list\n (setq ,name (car ,list))\n ,@body\n (setq ,list (cdr ,list)))\n ,@(if (cddr spec)\n ~((setq ,name nil)\n ,(caddr spec))))))\n\n(defmacro dotimes (spec \u0026rest body) ; (dotimes (name count [result]) body...)\n (let ((name (car spec))\n (count (gensym)))\n ~(let ((,name 0)\n (,count ,(cadr spec)))\n (while (\u003c ,name ,count)\n ,@body\n (setq ,name (+ ,name 1)))\n ,@(if (cddr spec)\n ~(,(caddr spec))))))\n`, \"~\", \"`\", -1)\n\n/*\n Copyright (c) 2015, 2016 OKI Software Co., Ltd.\n\n Permission is hereby granted, free of charge, to any person obtaining a\n copy of this software and associated documentation files (the \"Software\"),\n to deal in the Software without restriction, including without limitation\n the rights to use, copy, modify, merge, publish, distribute, sublicense,\n and/or sell copies of the Software, and to permit persons to whom the\n Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n DEALINGS IN THE SOFTWARE.\n*/\n"},"lineMatches":[{"preview":"func Main(args []string) int {","lineNumber":1530,"offsetAndLengths":[[0,10]]},{"preview":"func main() {","lineNumber":1560,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/devspace-sh/devspace"},"file":{"path":"vendor/github.com/google/gnostic-models/extensions/extensions.go","url":"/github.com/devspace-sh/devspace/-/blob/vendor/github.com/google/gnostic-models/extensions/extensions.go","content":"// Copyright 2017 Google LLC. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gnostic_extension_v1\n\nimport (\n\t\"io/ioutil\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/golang/protobuf/proto\"\n\t\"github.com/golang/protobuf/ptypes\"\n)\n\ntype extensionHandler func(name string, yamlInput string) (bool, proto.Message, error)\n\n// Main implements the main program of an extension handler.\nfunc Main(handler extensionHandler) {\n\t// unpack the request\n\tdata, err := ioutil.ReadAll(os.Stdin)\n\tif err != nil {\n\t\tlog.Println(\"File error:\", err.Error())\n\t\tos.Exit(1)\n\t}\n\tif len(data) == 0 {\n\t\tlog.Println(\"No input data.\")\n\t\tos.Exit(1)\n\t}\n\trequest := \u0026ExtensionHandlerRequest{}\n\terr = proto.Unmarshal(data, request)\n\tif err != nil {\n\t\tlog.Println(\"Input error:\", err.Error())\n\t\tos.Exit(1)\n\t}\n\t// call the handler\n\thandled, output, err := handler(request.Wrapper.ExtensionName, request.Wrapper.Yaml)\n\t// respond with the output of the handler\n\tresponse := \u0026ExtensionHandlerResponse{\n\t\tHandled: false, // default assumption\n\t\tErrors: make([]string, 0),\n\t}\n\tif err != nil {\n\t\tresponse.Errors = append(response.Errors, err.Error())\n\t} else if handled {\n\t\tresponse.Handled = true\n\t\tresponse.Value, err = ptypes.MarshalAny(output)\n\t\tif err != nil {\n\t\t\tresponse.Errors = append(response.Errors, err.Error())\n\t\t}\n\t}\n\tresponseBytes, _ := proto.Marshal(response)\n\tos.Stdout.Write(responseBytes)\n}\n"},"lineMatches":[{"preview":"func Main(handler extensionHandler) {","lineNumber":28,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/cubefs/cubefs"},"file":{"path":"blobstore/cmd/cmd.go","url":"/github.com/cubefs/cubefs/-/blob/blobstore/cmd/cmd.go","content":"// Copyright 2022 The CubeFS Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n// implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage cmd\n\nimport (\n\t\"context\"\n\t\"io\"\n\t\"net\"\n\t\"net/http\"\n\t\"os\"\n\t\"os/signal\"\n\t\"runtime\"\n\t\"syscall\"\n\t\"time\"\n\n\t\"gopkg.in/natefinch/lumberjack.v2\"\n\n\t\"github.com/cubefs/cubefs/blobstore/common/config\"\n\t\"github.com/cubefs/cubefs/blobstore/common/profile\"\n\t\"github.com/cubefs/cubefs/blobstore/common/rpc\"\n\t\"github.com/cubefs/cubefs/blobstore/common/rpc/auditlog\"\n\t\"github.com/cubefs/cubefs/blobstore/common/rpc/auth\"\n\tauth_proto \"github.com/cubefs/cubefs/blobstore/common/rpc/auth/proto\"\n\t\"github.com/cubefs/cubefs/blobstore/common/rpc2\"\n\t\"github.com/cubefs/cubefs/blobstore/util/graceful\"\n\t\"github.com/cubefs/cubefs/blobstore/util/log\"\n\n\t// module release init functions\n\t_ \"github.com/cubefs/cubefs/blobstore/util/version\"\n)\n\nconst (\n\tdefaultShutdownTimeoutS = 30\n)\n\ntype LogConfig struct {\n\tLevel log.Level `json:\"level\"`\n\tFilename string `json:\"filename\"`\n\tMaxSize int `json:\"maxsize\"`\n\tMaxAge int `json:\"maxage\"`\n\tMaxBackups int `json:\"maxbackups\"`\n\tCompress bool `json:\"compress\"`\n}\n\ntype Config struct {\n\tMaxProcs int `json:\"max_procs\"`\n\tLogConf LogConfig `json:\"log\"`\n\tBindAddr string `json:\"bind_addr\"`\n\tShutdownTimeoutS int `json:\"shutdown_timeout_s\"`\n\n\tAuditLog auditlog.Config `json:\"auditlog\"`\n\tAuth auth_proto.Config `json:\"auth\"`\n\n\tRpc2Server *rpc2.Server `json:\"rpc2_server,omitempty\"`\n}\n\ntype Module struct {\n\tName string\n\tInitConfig func(args []string) (*Config, error)\n\tSetUp func() (*rpc.Router, []rpc.ProgressHandler)\n\tSetUp2 func() (*rpc2.Router, []rpc2.Interceptor)\n\tTearDown func()\n\tgraceful bool\n}\n\nvar mod *Module\n\nfunc RegisterModule(m *Module) {\n\tmod = m\n\tmod.graceful = false\n}\n\nfunc RegisterGracefulModule(m *Module) {\n\tmod = m\n\tmod.graceful = true\n}\n\nfunc NewLogWriter(cfg *LogConfig) io.Writer {\n\tmaxsize := cfg.MaxSize\n\tif maxsize == 0 {\n\t\tmaxsize = 1024\n\t}\n\tmaxage := cfg.MaxAge\n\tif maxage == 0 {\n\t\tmaxage = 7\n\t}\n\tmaxbackups := cfg.MaxBackups\n\tif maxbackups == 0 {\n\t\tmaxbackups = 7\n\t}\n\treturn \u0026lumberjack.Logger{\n\t\tFilename: cfg.Filename,\n\t\tMaxSize: maxsize,\n\t\tMaxAge: maxage,\n\t\tMaxBackups: maxbackups,\n\t\tLocalTime: true,\n\t\tCompress: cfg.Compress,\n\t}\n}\n\nfunc Main(args []string) {\n\tcfg, err := mod.InitConfig(args)\n\tif err != nil {\n\t\tlog.Fatalf(\"init config error: %v\", err)\n\t}\n\tif cfg.MaxProcs \u003e 0 {\n\t\truntime.GOMAXPROCS(cfg.MaxProcs)\n\t}\n\tlog.SetOutputLevel(cfg.LogConf.Level)\n\tregisterLogLevel()\n\tif cfg.LogConf.Filename != \"\" {\n\t\tlog.SetOutput(NewLogWriter(\u0026cfg.LogConf))\n\t}\n\tif cfg.ShutdownTimeoutS \u003c= 0 {\n\t\tcfg.ShutdownTimeoutS = defaultShutdownTimeoutS\n\t}\n\n\tlh, logf, err := auditlog.Open(mod.Name, \u0026cfg.AuditLog)\n\tif err != nil {\n\t\tlog.Fatal(\"failed to open auditlog:\", err)\n\t}\n\tif logf != nil {\n\t\tdefer logf.Close()\n\t}\n\n\tctx, cancel1 := context.WithCancel(context.Background())\n\tdefer cancel1()\n\tconfig.HotReload(ctx, config.ConfName())\n\n\t// new profile handler firstly\n\tprofileHandler := profile.NewProfileHandler(cfg.BindAddr)\n\n\tif mod.SetUp != nil \u0026\u0026 mod.graceful {\n\t\tprogramEntry := func(state *graceful.State) {\n\t\t\trouter, handlers := mod.SetUp()\n\t\t\thttpServer := \u0026http.Server{\n\t\t\t\tAddr: cfg.BindAddr,\n\t\t\t\tHandler: reorderMiddleWareHandlers(router, lh, profileHandler, cfg.Auth, handlers),\n\t\t\t\tReadTimeout: 5 * time.Minute,\n\t\t\t\tWriteTimeout: 5 * time.Minute,\n\t\t\t}\n\n\t\t\tlog.Info(\"server is running at:\", cfg.BindAddr)\n\t\t\tgo func() {\n\t\t\t\tif err := httpServer.Serve(state.ListenerFds[0].(*net.TCPListener)); err != nil \u0026\u0026 err != http.ErrServerClosed {\n\t\t\t\t\tlog.Fatal(\"server exits:\", err)\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\t// wait for signal\n\t\t\t\u003c-state.CloseCh\n\t\t\tlog.Info(\"graceful shutdown...\")\n\t\t\tctx, cancel := context.WithTimeout(context.Background(), time.Duration(cfg.ShutdownTimeoutS)*time.Second)\n\t\t\tdefer cancel()\n\t\t\thttpServer.Shutdown(ctx)\n\n\t\t\tif mod.TearDown != nil {\n\t\t\t\tmod.TearDown()\n\t\t\t}\n\t\t}\n\t\tgraceful.Run(\u0026graceful.Config{\n\t\t\tEntry: programEntry,\n\t\t\tListenAddresses: []string{cfg.BindAddr},\n\t\t})\n\t\treturn\n\t}\n\n\tvar shutdowns []func(context.Context)\n\tif mod.SetUp2 != nil {\n\t\trouter, interceptors := mod.SetUp2()\n\t\trpc2Server := cfg.Rpc2Server\n\t\trpc2Server.Handler = rpc2Handler(router, lh, cfg.Auth, interceptors)\n\t\tlog.Info(\"rpc2 Server is running at\", rpc2Server.Addresses)\n\t\tgo func() {\n\t\t\tif err := rpc2Server.Serve(); err != nil \u0026\u0026 err != rpc2.ErrServerClosed {\n\t\t\t\tlog.Fatalf(\"rpc2 Server exits, err: %v\", err)\n\t\t\t}\n\t\t}()\n\t\tshutdowns = append(shutdowns, func(ctx context.Context) { rpc2Server.Shutdown(ctx) })\n\t}\n\n\tif mod.SetUp != nil {\n\t\trouter, handlers := mod.SetUp()\n\t\thttpServer := \u0026http.Server{\n\t\t\tAddr: cfg.BindAddr,\n\t\t\tHandler: reorderMiddleWareHandlers(router, lh, profileHandler, cfg.Auth, handlers),\n\t\t\tReadTimeout: 5 * time.Minute,\n\t\t\tWriteTimeout: 5 * time.Minute,\n\t\t}\n\n\t\tlog.Info(\"Server is running at\", cfg.BindAddr)\n\t\tgo func() {\n\t\t\tif err := httpServer.ListenAndServe(); err != nil \u0026\u0026 err != http.ErrServerClosed {\n\t\t\t\tlog.Fatalf(\"Server exits, err: %v\", err)\n\t\t\t}\n\t\t}()\n\t\tshutdowns = append(shutdowns, func(ctx context.Context) { httpServer.Shutdown(ctx) })\n\t}\n\n\t// wait for signal\n\tch := make(chan os.Signal, 1)\n\tsignal.Notify(ch, syscall.SIGTERM, syscall.SIGINT)\n\tsig := \u003c-ch\n\tlog.Infof(\"receive signal: %s, stop service...\", sig.String())\n\tctx, cancel := context.WithTimeout(context.Background(), time.Duration(cfg.ShutdownTimeoutS)*time.Second)\n\tdefer cancel()\n\tfor _, shutdown := range shutdowns {\n\t\tshutdown(ctx)\n\t}\n\n\tif mod.TearDown != nil {\n\t\tmod.TearDown()\n\t}\n}\n\n// reorderMiddleWareHandlers\n//\n//\tthe order of handlers in MiddlewareHandler has some constraints:\n//\t1. the first is router,\n//\t2. the second is AuditLog handler,\n//\t3. the third is profile handler if config,\n//\t4. the fourth is Auth handler if config,\n//\t5. others self define handlers by modules.\nfunc reorderMiddleWareHandlers(r *rpc.Router, lh, profileHandler rpc.ProgressHandler,\n\tauthCfg auth_proto.Config, handlers []rpc.ProgressHandler,\n) (mux http.Handler) {\n\ths := []rpc.ProgressHandler{lh}\n\tif profileHandler != nil {\n\t\ths = append(hs, profileHandler)\n\t}\n\tif authCfg.EnableAuth \u0026\u0026 authCfg.Secret != \"\" {\n\t\ths = append(hs, auth.New(\u0026authCfg))\n\t}\n\ths = append(hs, handlers...)\n\treturn rpc.MiddlewareHandlerWith(r, hs...)\n}\n\nfunc rpc2Handler(r *rpc2.Router, auditlogIc rpc2.Interceptor,\n\tauthCfg auth_proto.Config, interceptors []rpc2.Interceptor,\n) rpc2.Handle {\n\tr.Interceptor(auditlogIc)\n\tif authCfg.EnableAuth \u0026\u0026 authCfg.Secret != \"\" {\n\t\tr.Interceptor(auth.New(\u0026authCfg))\n\t}\n\tr.Interceptor(interceptors...)\n\treturn r.MakeHandler()\n}\n\nfunc registerLogLevel() {\n\tlogLevelPath, logLevelHandler := log.ChangeDefaultLevelHandler()\n\tprofile.HandleFunc(http.MethodPost, logLevelPath, func(c *rpc.Context) {\n\t\tlogLevelHandler.ServeHTTP(c.Writer, c.Request)\n\t})\n\tprofile.HandleFunc(http.MethodGet, logLevelPath, func(c *rpc.Context) {\n\t\tlogLevelHandler.ServeHTTP(c.Writer, c.Request)\n\t})\n}\n"},"lineMatches":[{"preview":"func Main(args []string) {","lineNumber":112,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/aarzilli/gdlv"},"file":{"path":"vendor/golang.org/x/exp/shiny/driver/driver.go","url":"/github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/driver.go","content":"// Copyright 2015 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// Package driver provides the default driver for accessing a screen.\npackage driver // import \"golang.org/x/exp/shiny/driver\"\n\n// TODO: figure out what to say about the responsibility for users of this\n// package to check any implicit dependencies'' LICENSEs. For example, the\n// driver might use third party software outside of golang.org/x, like an X11\n// or OpenGL library.\n\nimport (\n\t\"golang.org/x/exp/shiny/screen\"\n)\n\n// Main is called by the program''s main function to run the graphical\n// application.\n//\n// It calls f on the Screen, possibly in a separate goroutine, as some OS-\n// specific libraries require being on ''the main thread''. It returns when f\n// returns.\nfunc Main(f func(screen.Screen)) {\n\tmain(f)\n}\n"},"lineMatches":[{"preview":"func Main(f func(screen.Screen)) {","lineNumber":22,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/aarzilli/gdlv"},"file":{"path":"vendor/golang.org/x/exp/shiny/driver/windriver/other.go","url":"/github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/windriver/other.go","content":"// Copyright 2015 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n//go:build !windows\n\npackage windriver\n\nimport (\n\t\"fmt\"\n\t\"runtime\"\n\n\t\"golang.org/x/exp/shiny/driver/internal/errscreen\"\n\t\"golang.org/x/exp/shiny/screen\"\n)\n\n// Main is called by the program''s main function to run the graphical\n// application.\n//\n// It calls f on the Screen, possibly in a separate goroutine, as some OS-\n// specific libraries require being on ''the main thread''. It returns when f\n// returns.\nfunc Main(f func(screen.Screen)) {\n\tf(errscreen.Stub(fmt.Errorf(\n\t\t\"windriver: unsupported GOOS/GOARCH %s/%s\", runtime.GOOS, runtime.GOARCH)))\n}\n"},"lineMatches":[{"preview":"func Main(f func(screen.Screen)) {","lineNumber":22,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/aarzilli/gdlv"},"file":{"path":"vendor/golang.org/x/exp/shiny/driver/gldriver/gldriver.go","url":"/github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/gldriver/gldriver.go","content":"// Copyright 2015 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// Package gldriver provides an OpenGL driver for accessing a screen.\npackage gldriver // import \"golang.org/x/exp/shiny/driver/gldriver\"\n\nimport (\n\t\"encoding/binary\"\n\t\"fmt\"\n\t\"math\"\n\n\t\"golang.org/x/exp/shiny/driver/internal/errscreen\"\n\t\"golang.org/x/exp/shiny/screen\"\n\t\"golang.org/x/image/math/f64\"\n\t\"golang.org/x/mobile/gl\"\n)\n\n// Main is called by the program''s main function to run the graphical\n// application.\n//\n// It calls f on the Screen, possibly in a separate goroutine, as some OS-\n// specific libraries require being on ''the main thread''. It returns when f\n// returns.\nfunc Main(f func(screen.Screen)) {\n\tif err := main(f); err != nil {\n\t\tf(errscreen.Stub(err))\n\t}\n}\n\nfunc mul(a, b f64.Aff3) f64.Aff3 {\n\treturn f64.Aff3{\n\t\ta[0]*b[0] + a[1]*b[3],\n\t\ta[0]*b[1] + a[1]*b[4],\n\t\ta[0]*b[2] + a[1]*b[5] + a[2],\n\n\t\ta[3]*b[0] + a[4]*b[3],\n\t\ta[3]*b[1] + a[4]*b[4],\n\t\ta[3]*b[2] + a[4]*b[5] + a[5],\n\t}\n}\n\n// writeAff3 must only be called while holding windowImpl.glctxMu.\nfunc writeAff3(glctx gl.Context, u gl.Uniform, a f64.Aff3) {\n\tvar m [9]float32\n\tm[0*3+0] = float32(a[0*3+0])\n\tm[0*3+1] = float32(a[1*3+0])\n\tm[0*3+2] = 0\n\tm[1*3+0] = float32(a[0*3+1])\n\tm[1*3+1] = float32(a[1*3+1])\n\tm[1*3+2] = 0\n\tm[2*3+0] = float32(a[0*3+2])\n\tm[2*3+1] = float32(a[1*3+2])\n\tm[2*3+2] = 1\n\tglctx.UniformMatrix3fv(u, m[:])\n}\n\n// f32Bytes returns the byte representation of float32 values in the given byte\n// order. byteOrder must be either binary.BigEndian or binary.LittleEndian.\nfunc f32Bytes(byteOrder binary.ByteOrder, values ...float32) []byte {\n\tle := false\n\tswitch byteOrder {\n\tcase binary.BigEndian:\n\tcase binary.LittleEndian:\n\t\tle = true\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"invalid byte order %v\", byteOrder))\n\t}\n\n\tb := make([]byte, 4*len(values))\n\tfor i, v := range values {\n\t\tu := math.Float32bits(v)\n\t\tif le {\n\t\t\tb[4*i+0] = byte(u \u003e\u003e 0)\n\t\t\tb[4*i+1] = byte(u \u003e\u003e 8)\n\t\t\tb[4*i+2] = byte(u \u003e\u003e 16)\n\t\t\tb[4*i+3] = byte(u \u003e\u003e 24)\n\t\t} else {\n\t\t\tb[4*i+0] = byte(u \u003e\u003e 24)\n\t\t\tb[4*i+1] = byte(u \u003e\u003e 16)\n\t\t\tb[4*i+2] = byte(u \u003e\u003e 8)\n\t\t\tb[4*i+3] = byte(u \u003e\u003e 0)\n\t\t}\n\t}\n\treturn b\n}\n\n// compileProgram must only be called while holding windowImpl.glctxMu.\nfunc compileProgram(glctx gl.Context, vSrc, fSrc string) (gl.Program, error) {\n\tprogram := glctx.CreateProgram()\n\tif program.Value == 0 {\n\t\treturn gl.Program{}, fmt.Errorf(\"gldriver: no programs available\")\n\t}\n\n\tvertexShader, err := compileShader(glctx, gl.VERTEX_SHADER, vSrc)\n\tif err != nil {\n\t\treturn gl.Program{}, err\n\t}\n\tfragmentShader, err := compileShader(glctx, gl.FRAGMENT_SHADER, fSrc)\n\tif err != nil {\n\t\tglctx.DeleteShader(vertexShader)\n\t\treturn gl.Program{}, err\n\t}\n\n\tglctx.AttachShader(program, vertexShader)\n\tglctx.AttachShader(program, fragmentShader)\n\tglctx.LinkProgram(program)\n\n\t// Flag shaders for deletion when program is unlinked.\n\tglctx.DeleteShader(vertexShader)\n\tglctx.DeleteShader(fragmentShader)\n\n\tif glctx.GetProgrami(program, gl.LINK_STATUS) == 0 {\n\t\tdefer glctx.DeleteProgram(program)\n\t\treturn gl.Program{}, fmt.Errorf(\"gldriver: program compile: %s\", glctx.GetProgramInfoLog(program))\n\t}\n\treturn program, nil\n}\n\n// compileShader must only be called while holding windowImpl.glctxMu.\nfunc compileShader(glctx gl.Context, shaderType gl.Enum, src string) (gl.Shader, error) {\n\tshader := glctx.CreateShader(shaderType)\n\tif shader.Value == 0 {\n\t\treturn gl.Shader{}, fmt.Errorf(\"gldriver: could not create shader (type %v)\", shaderType)\n\t}\n\tglctx.ShaderSource(shader, src)\n\tglctx.CompileShader(shader)\n\tif glctx.GetShaderi(shader, gl.COMPILE_STATUS) == 0 {\n\t\tdefer glctx.DeleteShader(shader)\n\t\treturn gl.Shader{}, fmt.Errorf(\"gldriver: shader compile: %s\", glctx.GetShaderInfoLog(shader))\n\t}\n\treturn shader, nil\n}\n"},"lineMatches":[{"preview":"func Main(f func(screen.Screen)) {","lineNumber":24,"offsetAndLengths":[[0,10]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/aarzilli/gdlv"},"file":{"path":"vendor/golang.org/x/exp/shiny/driver/mtldriver/mtldriver.go","url":"/github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/mtldriver/mtldriver.go","content":"// Copyright 2019 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n//go:build darwin \u0026\u0026 cgo\n\n// Package mtldriver provides a Metal driver for accessing a screen.\n//\n// At this time, the Metal API is used only to present the final pixels\n// to the screen. All rendering is performed on the CPU via the image/draw\n// algorithms. Future work is to use mtl.Buffer, mtl.Texture, etc., and\n// do more of the rendering work on the GPU.\npackage mtldriver\n\nimport (\n\t\"runtime\"\n\t\"unsafe\"\n\n\t\"dmitri.shuralyov.com/gpu/mtl\"\n\t\"github.com/go-gl/glfw/v3.3/glfw\"\n\t\"golang.org/x/exp/shiny/driver/internal/errscreen\"\n\t\"golang.org/x/exp/shiny/driver/mtldriver/internal/appkit\"\n\t\"golang.org/x/exp/shiny/driver/mtldriver/internal/coreanim\"\n\t\"golang.org/x/exp/shiny/screen\"\n\t\"golang.org/x/mobile/event/key\"\n\t\"golang.org/x/mobile/event/mouse\"\n\t\"golang.org/x/mobile/event/paint\"\n\t\"golang.org/x/mobile/event/size\"\n)\n\nfunc init() {\n\truntime.LockOSThread()\n}\n\n// Main is called by the program''s main function to run the graphical\n// application.\n//\n// It calls f on the Screen, possibly in a separate goroutine, as some OS-\n// specific libraries require being on ''the main thread''. It returns when f\n// returns.\nfunc Main(f func(screen.Screen)) {\n\tif err := main(f); err != nil {\n\t\tf(errscreen.Stub(err))\n\t}\n}\n\nfunc main(f func(screen.Screen)) error {\n\tdevice, err := mtl.CreateSystemDefaultDevice()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = glfw.Init()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer glfw.Terminate()\n\tglfw.WindowHint(glfw.ClientAPI, glfw.NoAPI)\n\t{\n\t\t// TODO(dmitshur): Delete this when https://github.com/go-gl/glfw/issues/272 is resolved.\n\t\t// Post an empty event from the main thread before it can happen in a non-main thread,\n\t\t// to work around https://github.com/glfw/glfw/issues/1649.\n\t\tglfw.PostEmptyEvent()\n\t}\n\tvar (\n\t\tdone = make(chan struct{})\n\t\tnewWindowCh = make(chan newWindowReq, 1)\n\t\treleaseWindowCh = make(chan releaseWindowReq, 1)\n\t)\n\tgo func() {\n\t\tf(\u0026screenImpl{\n\t\t\tnewWindowCh: newWindowCh,\n\t\t})\n\t\tclose(done)\n\t\tglfw.PostEmptyEvent() // Break main loop out of glfw.WaitEvents so it can receive on done.\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase \u003c-done:\n\t\t\treturn nil\n\t\tcase req := \u003c-newWindowCh:\n\t\t\tw, err := newWindow(device, releaseWindowCh, req.opts)\n\t\t\treq.respCh \u003c- newWindowResp{w, err}\n\t\tcase req := \u003c-releaseWindowCh:\n\t\t\treq.window.Destroy()\n\t\t\treq.respCh \u003c- struct{}{}\n\t\tdefault:\n\t\t\tglfw.WaitEvents()\n\t\t}\n\t}\n}\n\ntype newWindowReq struct {\n\topts *screen.NewWindowOptions\n\trespCh chan newWindowResp\n}\n\ntype newWindowResp struct {\n\tw screen.Window\n\terr error\n}\n\ntype releaseWindowReq struct {\n\twindow *glfw.Window\n\trespCh chan struct{}\n}\n\n// newWindow creates a new GLFW window.\n// It must be called on the main thread.\nfunc newWindow(device mtl.Device, releaseWindowCh chan releaseWindowReq, opts *screen.NewWindowOptions) (screen.Window, error) {\n\twidth, height := optsSize(opts)\n\twindow, err := glfw.CreateWindow(width, height, opts.GetTitle(), nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tml := coreanim.MakeMetalLayer()\n\tml.SetDevice(device)\n\tml.SetPixelFormat(mtl.PixelFormatBGRA8UNorm)\n\tml.SetMaximumDrawableCount(3)\n\tml.SetDisplaySyncEnabled(true)\n\tcv := appkit.NewWindow(unsafe.Pointer(window.GetCocoaWindow())).ContentView()\n\tcv.SetLayer(ml)\n\tcv.SetWantsLayer(true)\n\n\tw := \u0026windowImpl{\n\t\tdevice: device,\n\t\twindow: window,\n\t\treleaseWindowCh: releaseWindowCh,\n\t\tml: ml,\n\t\tcq: device.MakeCommandQueue(),\n\t}\n\n\t// Set callbacks.\n\tframebufferSizeCallback := func(_ *glfw.Window, width, height int) {\n\t\tw.Send(size.Event{\n\t\t\tWidthPx: width,\n\t\t\tHeightPx: height,\n\t\t\t// TODO(dmitshur): ppp,\n\t\t})\n\t\tw.Send(paint.Event{External: true})\n\t}\n\twindow.SetFramebufferSizeCallback(framebufferSizeCallback)\n\twindow.SetCursorPosCallback(func(_ *glfw.Window, x, y float64) {\n\t\tconst scale = 2 // TODO(dmitshur): compute dynamically\n\t\tw.Send(mouse.Event{X: float32(x * scale), Y: float32(y * scale)})\n\t})\n\twindow.SetMouseButtonCallback(func(_ *glfw.Window, b glfw.MouseButton, a glfw.Action, mods glfw.ModifierKey) {\n\t\tbtn := glfwMouseButton(b)\n\t\tif btn == mouse.ButtonNone {\n\t\t\treturn\n\t\t}\n\t\tconst scale = 2 // TODO(dmitshur): compute dynamically\n\t\tx, y := window.GetCursorPos()\n\t\tw.Send(mouse.Event{\n\t\t\tX: float32(x * scale), Y: float32(y * scale),\n\t\t\tButton: btn,\n\t\t\tDirection: glfwMouseDirection(a),\n\t\t\t// TODO(dmitshur): set Modifiers\n\t\t})\n\t})\n\twindow.SetKeyCallback(func(_ *glfw.Window, k glfw.Key, _ int, a glfw.Action, mods glfw.ModifierKey) {\n\t\tcode := glfwKeyCode(k)\n\t\tif code == key.CodeUnknown {\n\t\t\treturn\n\t\t}\n\t\tw.Send(key.Event{\n\t\t\tCode: code,\n\t\t\tDirection: glfwKeyDirection(a),\n\t\t\t// TODO(dmitshur): set Modifiers\n\t\t})\n\t})\n\t// TODO(dmitshur): set CharModsCallback to catch text (runes) that are typed,\n\t// and perhaps try to unify key pressed + character typed into single event\n\twindow.SetCloseCallback(func(*glfw.Window) {\n\t\tw.lifecycler.SetDead(true)\n\t\tw.lifecycler.SendEvent(w, nil)\n\t})\n\n\t// TODO(dmitshur): more fine-grained tracking of whether window is visible and/or focused\n\tw.lifecycler.SetDead(false)\n\tw.lifecycler.SetVisible(true)\n\tw.lifecycler.SetFocused(true)\n\tw.lifecycler.SendEvent(w, nil)\n\n\t// Send the initial size and paint events.\n\twidth, height = window.GetFramebufferSize()\n\tframebufferSizeCallback(window, width, height)\n\n\treturn w, nil\n}\n\nfunc optsSize(opts *screen.NewWindowOptions) (width, height int) {\n\twidth, height = 1024/2, 768/2\n\tif opts != nil {\n\t\tif opts.Width \u003e 0 {\n\t\t\twidth = opts.Width\n\t\t}\n\t\tif opts.Height \u003e 0 {\n\t\t\theight = opts.Height\n\t\t}\n\t}\n\treturn width, height\n}\n\nfunc glfwMouseButton(button glfw.MouseButton) mouse.Button {\n\tswitch button {\n\tcase glfw.MouseButtonLeft:\n\t\treturn mouse.ButtonLeft\n\tcase glfw.MouseButtonRight:\n\t\treturn mouse.ButtonRight\n\tcase glfw.MouseButtonMiddle:\n\t\treturn mouse.ButtonMiddle\n\tdefault:\n\t\treturn mouse.ButtonNone\n\t}\n}\n\nfunc glfwMouseDirection(action glfw.Action) mouse.Direction {\n\tswitch action {\n\tcase glfw.Press:\n\t\treturn mouse.DirPress\n\tcase glfw.Release:\n\t\treturn mouse.DirRelease\n\tdefault:\n\t\tpanic(\"unreachable\")\n\t}\n}\n\nfunc glfwKeyCode(k glfw.Key) key.Code {\n\t// TODO(dmitshur): support more keys\n\tswitch k {\n\tcase glfw.KeyEnter:\n\t\treturn key.CodeReturnEnter\n\tcase glfw.KeyEscape:\n\t\treturn key.CodeEscape\n\tdefault:\n\t\treturn key.CodeUnknown\n\t}\n}\n\nfunc glfwKeyDirection(action glfw.Action) key.Direction {\n\tswitch action {\n\tcase glfw.Press:\n\t\treturn key.DirPress\n\tcase glfw.Release:\n\t\treturn key.DirRelease\n\tcase glfw.Repeat:\n\t\treturn key.DirNone\n\tdefault:\n\t\tpanic(\"unreachable\")\n\t}\n}\n"},"lineMatches":[{"preview":"func Main(f func(screen.Screen)) {","lineNumber":40,"offsetAndLengths":[[0,10]]},{"preview":"func main(f func(screen.Screen)) error {","lineNumber":46,"offsetAndLengths":[[0,10]]}]}]}}}}' headers: Content-Type: - application/json status: 200 OK code: 200 - duration: 1.410189333s + duration: 1.391930625s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 46129 + content_length: 48618 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_WgfXGWFY5hBNcKY4ZHs5U2Cs\",\"function\":{\"arguments\":\"{\\\"query\\\":\\\"lang:go \\\\\\\"func main(\\\\\\\" select:file count:20\\\",\\\"count\\\":20,\\\"context_window\\\":8}\",\"name\":\"sourcegraph\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"# Sourcegraph Search Results\\n\\nFound 20 matches across 20 results\\n(Result limit reached, try a more specific query)\\n\\n## Result 1: github.com/yunabe/lgo/cmd/lgo-internal/liner/liner_test.go\\n\\nURL: /github.com/yunabe/lgo/-/blob/cmd/lgo-internal/liner/liner_test.go\\n\\n## Result 2: github.com/ibarryyan/golang-tips-100/code/code_01/main_exit.go\\n\\nURL: /github.com/ibarryyan/golang-tips-100/-/blob/code/code_01/main_exit.go\\n\\n## Result 3: github.com/unigornel/unigornel/integration_tests/tests/console/simple/main.go\\n\\nURL: /github.com/unigornel/unigornel/-/blob/integration_tests/tests/console/simple/main.go\\n\\n## Result 4: github.com/jiro4989/textimg/main.go\\n\\nURL: /github.com/jiro4989/textimg/-/blob/main.go\\n\\n## Result 5: github.com/naeemaei/Golang-Tutorial/15-Concurrency/09-Channels/main.go\\n\\nURL: /github.com/naeemaei/Golang-Tutorial/-/blob/15-Concurrency/09-Channels/main.go\\n\\n## Result 6: github.com/unigornel/unigornel/integration_tests/tests/console/sleep_and_time/main.go\\n\\nURL: /github.com/unigornel/unigornel/-/blob/integration_tests/tests/console/sleep_and_time/main.go\\n\\n## Result 7: github.com/unigornel/unigornel/integration_tests/tests/console/read_from_console/main.go\\n\\nURL: /github.com/unigornel/unigornel/-/blob/integration_tests/tests/console/read_from_console/main.go\\n\\n## Result 8: github.com/MichaelCade/90DaysOfDevOps/2022/tr/Days/Go/hello.go\\n\\nURL: /github.com/MichaelCade/90DaysOfDevOps/-/blob/2022/tr/Days/Go/hello.go\\n\\n## Result 9: github.com/MichaelCade/90DaysOfDevOps/2022/es/Days/Go/hello.go\\n\\nURL: /github.com/MichaelCade/90DaysOfDevOps/-/blob/2022/es/Days/Go/hello.go\\n\\n## Result 10: github.com/gostaticanalysis/skeleton/v2/skeleton/_template/ssa/cmd/@@.Pkg@@/main.go\\n\\nURL: /github.com/gostaticanalysis/skeleton/-/blob/v2/skeleton/_template/ssa/cmd/@@.Pkg@@/main.go\\n\\n\",\"tool_call_id\":\"call_WgfXGWFY5hBNcKY4ZHs5U2Cs\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_aJVDFP0W6iLFKxt3YI1ufrYh\",\"function\":{\"arguments\":\"{\\\"query\\\":\\\"lang:go file:\\\\\\\\.go$ content:\\\\\\\"func main(\\\\\\\" -file:test -file:_test.go count:10\\\",\\\"count\\\":10,\\\"context_window\\\":5,\\\"timeout\\\":60}\",\"name\":\"sourcegraph\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"# Sourcegraph Search Results\\n\\nFound 10 matches across 10 results\\n(Result limit reached, try a more specific query)\\n\\n## Result 1: github.com/yinchengtsinghua/go-ethereum-chinese/cmd/wnode/main.go\\n\\nURL: /github.com/yinchengtsinghua/go-ethereum-chinese/-/blob/cmd/wnode/main.go\\n\\n```\\n111| \\targIDFile = flag.String(\\\"idfile\\\", \\\"\\\", \\\"file name with node id (private key)\\\")\\n112| argEnode = flag.String(\\\"boot\\\", \\\"\\\", \\\"bootstrap node you want to connect to (e.g. enode://E454……08D50@52.176.211.200:16428)”)\\n113| \\targTopic = flag.String(\\\"topic\\\", \\\"\\\", \\\"topic in hexadecimal format (e.g. 70a4beef)\\\")\\n114| \\targSaveDir = flag.String(\\\"savedir\\\", \\\"\\\", \\\"directory where all incoming messages will be saved as files\\\")\\n115| )\\n116| func main() {\\n117| func main() {\\n118| \\tprocessArgs()\\n119| \\tinitialize()\\n120| \\trun()\\n121| \\tshutdown()\\n```\\n\\n## Result 2: github.com/sergev/vak-opensource/languages/go/lisp-light.go\\n\\nURL: /github.com/sergev/vak-opensource/-/blob/languages/go/lisp-light.go\\n\\n```\\n1525| \\t}\\n1526| }\\n1527| \\n1528| // Main runs each element of args as a name of Lisp script file.\\n1529| // It ignores args[0].\\n1530| func Main(args []string) int {\\n1531| func Main(args []string) int {\\n1532| \\tinterp := NewInterp()\\n1533| \\tss := strings.NewReader(Prelude)\\n1534| \\tif !Run(interp, ss) {\\n1535| \\t\\treturn 1\\n```\\n\\n```\\n1555| \\t\\t\\t}\\n1556| \\t\\t}\\n1557| \\t}\\n1558| \\treturn 0\\n1559| }\\n1560| func main() {\\n1561| func main() {\\n1562| \\tos.Exit(Main(os.Args))\\n1563| }\\n1564| \\n1565| // Prelude is an initialization script of Lisp.\\n```\\n\\n## Result 3: github.com/devspace-sh/devspace/vendor/github.com/google/gnostic-models/extensions/extensions.go\\n\\nURL: /github.com/devspace-sh/devspace/-/blob/vendor/github.com/google/gnostic-models/extensions/extensions.go\\n\\n```\\n23| \\t\\\"github.com/golang/protobuf/ptypes\\\"\\n24| )\\n25| \\n26| type extensionHandler func(name string, yamlInput string) (bool, proto.Message, error)\\n27| \\n28| func Main(handler extensionHandler) {\\n29| func Main(handler extensionHandler) {\\n30| \\t// unpack the request\\n31| \\tdata, err := ioutil.ReadAll(os.Stdin)\\n32| \\tif err != nil {\\n33| \\t\\tlog.Println(\\\"File error:\\\", err.Error())\\n```\\n\\n## Result 4: github.com/cubefs/cubefs/blobstore/cmd/cmd.go\\n\\nURL: /github.com/cubefs/cubefs/-/blob/blobstore/cmd/cmd.go\\n\\n```\\n107| \\t\\tMaxBackups: maxbackups,\\n108| \\t\\tLocalTime: true,\\n109| \\t\\tCompress: cfg.Compress,\\n110| \\t}\\n111| }\\n112| func Main(args []string) {\\n113| func Main(args []string) {\\n114| \\tcfg, err := mod.InitConfig(args)\\n115| \\tif err != nil {\\n116| \\t\\tlog.Fatalf(\\\"init config error: %v\\\", err)\\n117| \\t}\\n```\\n\\n## Result 5: github.com/aarzilli/gdlv/vendor/golang.org/x/exp/shiny/driver/driver.go\\n\\nURL: /github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/driver.go\\n\\n```\\n17| // Main is called by the program's main function to run the graphical\\n18| // application.\\n19| //\\n20| // It calls f on the Screen, possibly in a separate goroutine, as some OS-\\n21| // specific libraries require being on 'the main thread'. It returns when f\\n22| func Main(f func(screen.Screen)) {\\n23| func Main(f func(screen.Screen)) {\\n24| \\tmain(f)\\n25| }\\n26| \\n```\\n\\n## Result 6: github.com/aarzilli/gdlv/vendor/golang.org/x/exp/shiny/driver/windriver/other.go\\n\\nURL: /github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/windriver/other.go\\n\\n```\\n17| // Main is called by the program's main function to run the graphical\\n18| // application.\\n19| //\\n20| // It calls f on the Screen, possibly in a separate goroutine, as some OS-\\n21| // specific libraries require being on 'the main thread'. It returns when f\\n22| func Main(f func(screen.Screen)) {\\n23| func Main(f func(screen.Screen)) {\\n24| \\tf(errscreen.Stub(fmt.Errorf(\\n25| \\t\\t\\\"windriver: unsupported GOOS/GOARCH %s/%s\\\", runtime.GOOS, runtime.GOARCH)))\\n26| }\\n27| \\n```\\n\\n## Result 7: github.com/aarzilli/gdlv/vendor/golang.org/x/exp/shiny/driver/gldriver/gldriver.go\\n\\nURL: /github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/gldriver/gldriver.go\\n\\n```\\n19| // Main is called by the program's main function to run the graphical\\n20| // application.\\n21| //\\n22| // It calls f on the Screen, possibly in a separate goroutine, as some OS-\\n23| // specific libraries require being on 'the main thread'. It returns when f\\n24| func Main(f func(screen.Screen)) {\\n25| func Main(f func(screen.Screen)) {\\n26| \\tif err := main(f); err != nil {\\n27| \\t\\tf(errscreen.Stub(err))\\n28| \\t}\\n29| }\\n```\\n\\n## Result 8: github.com/aarzilli/gdlv/vendor/golang.org/x/exp/shiny/driver/mtldriver/mtldriver.go\\n\\nURL: /github.com/aarzilli/gdlv/-/blob/vendor/golang.org/x/exp/shiny/driver/mtldriver/mtldriver.go\\n\\n```\\n35| // Main is called by the program's main function to run the graphical\\n36| // application.\\n37| //\\n38| // It calls f on the Screen, possibly in a separate goroutine, as some OS-\\n39| // specific libraries require being on 'the main thread'. It returns when f\\n40| func Main(f func(screen.Screen)) {\\n41| func Main(f func(screen.Screen)) {\\n42| \\tif err := main(f); err != nil {\\n43| \\t\\tf(errscreen.Stub(err))\\n44| \\t}\\n45| }\\n```\\n\\n```\\n41| func Main(f func(screen.Screen)) {\\n42| \\tif err := main(f); err != nil {\\n43| \\t\\tf(errscreen.Stub(err))\\n44| \\t}\\n45| }\\n46| func main(f func(screen.Screen)) error {\\n47| func main(f func(screen.Screen)) error {\\n48| \\tdevice, err := mtl.CreateSystemDefaultDevice()\\n49| \\tif err != nil {\\n50| \\t\\treturn err\\n51| \\t}\\n```\\n\\n\",\"tool_call_id\":\"call_aJVDFP0W6iLFKxt3YI1ufrYh\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -200,149 +232,181 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"45uDlWcdJq"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"vLQSWcBgMy"} + + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Found"},"finish_reason":null}],"usage":null,"obfuscation":"hhoF2vR"} + + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" "},"finish_reason":null}],"usage":null,"obfuscation":"Y5fNHBhW1lE"} + + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"10"},"finish_reason":null}],"usage":null,"obfuscation":"KlflKAD0Pl"} + + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" matches"},"finish_reason":null}],"usage":null,"obfuscation":"w2IF"} + + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"finish_reason":null}],"usage":null,"obfuscation":"aXj30qklZ10"} + + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" Examples"},"finish_reason":null}],"usage":null,"obfuscation":"R6U"} + + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":\n"},"finish_reason":null}],"usage":null,"obfuscation":"jzlJQk7hk"} + + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"oULllVlGxrU"} + + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" github"},"finish_reason":null}],"usage":null,"obfuscation":"GAqul"} + + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".com"},"finish_reason":null}],"usage":null,"obfuscation":"w73hVZ4W"} + + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/y"},"finish_reason":null}],"usage":null,"obfuscation":"SbRgZe17Ww"} + + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"inch"},"finish_reason":null}],"usage":null,"obfuscation":"9xC1PH4d"} + + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"eng"},"finish_reason":null}],"usage":null,"obfuscation":"MdPgWHNTr"} + + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ts"},"finish_reason":null}],"usage":null,"obfuscation":"HVJFOQfBrZ"} + + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ing"},"finish_reason":null}],"usage":null,"obfuscation":"EJi1uO9PQ"} + + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"hua"},"finish_reason":null}],"usage":null,"obfuscation":"yuJrSwYYa"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"20"},"finish_reason":null}],"usage":null,"obfuscation":"qPs16VcPSf"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/go"},"finish_reason":null}],"usage":null,"obfuscation":"yrNyCZemG"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" results"},"finish_reason":null}],"usage":null,"obfuscation":"tb5T"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"UezMniCAZfB"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"."},"finish_reason":null}],"usage":null,"obfuscation":"NhjSCNkpZkM"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ethereum"},"finish_reason":null}],"usage":null,"obfuscation":"wS2E"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" Examples"},"finish_reason":null}],"usage":null,"obfuscation":"S2e"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-ch"},"finish_reason":null}],"usage":null,"obfuscation":"eRMHTbIsU"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":\n"},"finish_reason":null}],"usage":null,"obfuscation":"EbgoVzWWC"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"inese"},"finish_reason":null}],"usage":null,"obfuscation":"ipyfqvH"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"sXuoAflBbly"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/c"},"finish_reason":null}],"usage":null,"obfuscation":"2qyWpwcJhZ"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" github"},"finish_reason":null}],"usage":null,"obfuscation":"eQmj0"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"md"},"finish_reason":null}],"usage":null,"obfuscation":"SMbQCJiLlz"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".com"},"finish_reason":null}],"usage":null,"obfuscation":"1KeCpkm1"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"E5kT4r76fPZ"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"Tx72EhxnfDn"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"wn"},"finish_reason":null}],"usage":null,"obfuscation":"wvsGKAanpJ"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ib"},"finish_reason":null}],"usage":null,"obfuscation":"Gqaz7dtxYF"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ode"},"finish_reason":null}],"usage":null,"obfuscation":"owvFjlrw9"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"arry"},"finish_reason":null}],"usage":null,"obfuscation":"MbDfL28Z"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/main"},"finish_reason":null}],"usage":null,"obfuscation":"mnrLF4e"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"yan"},"finish_reason":null}],"usage":null,"obfuscation":"qtd2Fmfwh"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"1dJrD1OfV"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/g"},"finish_reason":null}],"usage":null,"obfuscation":"gtG0COyYrk"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":"},"finish_reason":null}],"usage":null,"obfuscation":"1qFNT70FSat"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"olang"},"finish_reason":null}],"usage":null,"obfuscation":"cMpI40w"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"116"},"finish_reason":null}],"usage":null,"obfuscation":"nidC1oA6w"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-t"},"finish_reason":null}],"usage":null,"obfuscation":"rV289k88sE"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"\n"},"finish_reason":null}],"usage":null,"obfuscation":"NP8KCWhhS1"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ips"},"finish_reason":null}],"usage":null,"obfuscation":"60IvYlXPY"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"XaGWGBEY8XK"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"6lIR6vOyOJ1"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" github"},"finish_reason":null}],"usage":null,"obfuscation":"U32mQ"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"100"},"finish_reason":null}],"usage":null,"obfuscation":"93AjMqFy3"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".com"},"finish_reason":null}],"usage":null,"obfuscation":"3cCYSER2"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/-"},"finish_reason":null}],"usage":null,"obfuscation":"odVWPv0yLN"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"2DAFbNK05Sc"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"OtiEs2W3YKi"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ser"},"finish_reason":null}],"usage":null,"obfuscation":"jaGn8JHSz"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"blob"},"finish_reason":null}],"usage":null,"obfuscation":"A02NXSLj"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"gev"},"finish_reason":null}],"usage":null,"obfuscation":"xDXf6Db8o"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/code"},"finish_reason":null}],"usage":null,"obfuscation":"r7mwgeq"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/v"},"finish_reason":null}],"usage":null,"obfuscation":"CMIZd5z8ma"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/code"},"finish_reason":null}],"usage":null,"obfuscation":"09mpsaS"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ak"},"finish_reason":null}],"usage":null,"obfuscation":"NKkLNwqE8z"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"_"},"finish_reason":null}],"usage":null,"obfuscation":"DdJ3vNaiXpi"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-op"},"finish_reason":null}],"usage":null,"obfuscation":"vt5ytaryA"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"01"},"finish_reason":null}],"usage":null,"obfuscation":"0GPqBjmr7R"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ens"},"finish_reason":null}],"usage":null,"obfuscation":"pJNhUAJBr"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/main"},"finish_reason":null}],"usage":null,"obfuscation":"yo8YaE2"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ource"},"finish_reason":null}],"usage":null,"obfuscation":"Yd5J9By"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"_exit"},"finish_reason":null}],"usage":null,"obfuscation":"OO6END8"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/l"},"finish_reason":null}],"usage":null,"obfuscation":"zrwABmKCKB"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"n9XNfX98H"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"anguages"},"finish_reason":null}],"usage":null,"obfuscation":"3arf"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"\n"},"finish_reason":null}],"usage":null,"obfuscation":"GWYHPRqrpe"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/go"},"finish_reason":null}],"usage":null,"obfuscation":"i2XIPHlsb"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"HU1lle2hWtY"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/l"},"finish_reason":null}],"usage":null,"obfuscation":"N5sdp3P2rX"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" github"},"finish_reason":null}],"usage":null,"obfuscation":"i2lIx"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"isp"},"finish_reason":null}],"usage":null,"obfuscation":"7YKoxxKOf"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".com"},"finish_reason":null}],"usage":null,"obfuscation":"sxkxS4U3"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-light"},"finish_reason":null}],"usage":null,"obfuscation":"EAUAdg"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"ED2MWXfsJti"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"SqhlkiUuO"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ji"},"finish_reason":null}],"usage":null,"obfuscation":"XrCrYIoklR"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":"},"finish_reason":null}],"usage":null,"obfuscation":"myJ7vjCSL7a"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ro"},"finish_reason":null}],"usage":null,"obfuscation":"cpfcQBvYY6"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"156"},"finish_reason":null}],"usage":null,"obfuscation":"UmHlK8sac"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"498"},"finish_reason":null}],"usage":null,"obfuscation":"s7bN2XteY"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"0"},"finish_reason":null}],"usage":null,"obfuscation":"jxENnYUP1fZ"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"9"},"finish_reason":null}],"usage":null,"obfuscation":"jp46LD5HLUU"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"\n"},"finish_reason":null}],"usage":null,"obfuscation":"ZV9X1WiqmM"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/text"},"finish_reason":null}],"usage":null,"obfuscation":"na6ZhSn"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"idUIBz2rRav"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"img"},"finish_reason":null}],"usage":null,"obfuscation":"yzZ9C2dEI"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" github"},"finish_reason":null}],"usage":null,"obfuscation":"cXu8g"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/-"},"finish_reason":null}],"usage":null,"obfuscation":"OBjV2cZmCu"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".com"},"finish_reason":null}],"usage":null,"obfuscation":"cFm9XQhZ"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"bXVVEWHOEZ0"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"JUzLgl0By6E"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"blob"},"finish_reason":null}],"usage":null,"obfuscation":"FuZ9onCN"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"aar"},"finish_reason":null}],"usage":null,"obfuscation":"GDW84ATUt"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/main"},"finish_reason":null}],"usage":null,"obfuscation":"VQ6qnGY"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"z"},"finish_reason":null}],"usage":null,"obfuscation":"IpZTzw44eWy"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"Qe5iXSRYR"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"illi"},"finish_reason":null}],"usage":null,"obfuscation":"ZPLWRc4j"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"\n"},"finish_reason":null}],"usage":null,"obfuscation":"w4kkTCzjx7"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/g"},"finish_reason":null}],"usage":null,"obfuscation":"YrdZ6nqk5l"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-"},"finish_reason":null}],"usage":null,"obfuscation":"GU5982l3Rhz"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"dl"},"finish_reason":null}],"usage":null,"obfuscation":"5r8YBKfjyD"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" github"},"finish_reason":null}],"usage":null,"obfuscation":"idSJZ"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"v"},"finish_reason":null}],"usage":null,"obfuscation":"34C7OiFTj43"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".com"},"finish_reason":null}],"usage":null,"obfuscation":"NiJSAEy9"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/vendor"},"finish_reason":null}],"usage":null,"obfuscation":"HAMtf"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"YrrkQPnofe4"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/g"},"finish_reason":null}],"usage":null,"obfuscation":"46sw9pJ3ta"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"nae"},"finish_reason":null}],"usage":null,"obfuscation":"w58Edenfy"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"olang"},"finish_reason":null}],"usage":null,"obfuscation":"Rma1YE0"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ema"},"finish_reason":null}],"usage":null,"obfuscation":"SqMtvVq2Q"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".org"},"finish_reason":null}],"usage":null,"obfuscation":"Jr7U9GIJ"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ei"},"finish_reason":null}],"usage":null,"obfuscation":"oXW8GhhNId"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/x"},"finish_reason":null}],"usage":null,"obfuscation":"bNpkeaEBBu"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/G"},"finish_reason":null}],"usage":null,"obfuscation":"2APijJdOTh"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"kBNsKUhMXcK"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"olang"},"finish_reason":null}],"usage":null,"obfuscation":"Z6UKEe7"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"exp"},"finish_reason":null}],"usage":null,"obfuscation":"2bQgVlVMF"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-T"},"finish_reason":null}],"usage":null,"obfuscation":"x7gYOxhaJZ"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/sh"},"finish_reason":null}],"usage":null,"obfuscation":"9I09Dmyvc"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"utorial"},"finish_reason":null}],"usage":null,"obfuscation":"lx6P0"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"iny"},"finish_reason":null}],"usage":null,"obfuscation":"dH2PmeRk3"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/-"},"finish_reason":null}],"usage":null,"obfuscation":"nMdtknNwAq"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"y555CEwokZi"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"7iWeiR1voNM"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"driver"},"finish_reason":null}],"usage":null,"obfuscation":"Ebv4px"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"blob"},"finish_reason":null}],"usage":null,"obfuscation":"rmeQ4sJU"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"1XoHh3e0rC2"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"Rd2ykiD4A9R"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"mt"},"finish_reason":null}],"usage":null,"obfuscation":"YiRAj0dEiD"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"15"},"finish_reason":null}],"usage":null,"obfuscation":"7MozeYd5kd"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ld"},"finish_reason":null}],"usage":null,"obfuscation":"yaSox1T9F1"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-Con"},"finish_reason":null}],"usage":null,"obfuscation":"1tpXQxk1"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"river"},"finish_reason":null}],"usage":null,"obfuscation":"N7iRoku"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"currency"},"finish_reason":null}],"usage":null,"obfuscation":"iaFb"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"elVyUJrLkOp"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/"},"finish_reason":null}],"usage":null,"obfuscation":"XgHvqZ5CL3O"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"mt"},"finish_reason":null}],"usage":null,"obfuscation":"UeTJiVTGYl"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"09"},"finish_reason":null}],"usage":null,"obfuscation":"poQTlUQYJU"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"ld"},"finish_reason":null}],"usage":null,"obfuscation":"cCOEGOKHwf"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"-Ch"},"finish_reason":null}],"usage":null,"obfuscation":"J3vpk0Kxx"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"river"},"finish_reason":null}],"usage":null,"obfuscation":"7swXicj"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"annels"},"finish_reason":null}],"usage":null,"obfuscation":"INXsS2"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"UmJEojQEi"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"/main"},"finish_reason":null}],"usage":null,"obfuscation":"IThuSww"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":":"},"finish_reason":null}],"usage":null,"obfuscation":"uZIKP3dYQxt"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":".go"},"finish_reason":null}],"usage":null,"obfuscation":"sojiHqm4d"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"46"},"finish_reason":null}],"usage":null,"obfuscation":"jNSsIb1yVu"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"UB2zWs"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"EN1DeW"} - data: {"id":"chatcmpl-CVk6muqFiszdb9OhP4AAgTgyyq1ds","object":"chat.completion.chunk","created":1761681444,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":10349,"completion_tokens":72,"total_tokens":10421,"prompt_tokens_details":{"cached_tokens":8832,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"7b"} + data: {"id":"chatcmpl-CVxhkemB3WTdZW6gxehoYt7nQSL9d","object":"chat.completion.chunk","created":1761733708,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":11187,"completion_tokens":1310,"total_tokens":12497,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":1216,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"91YjK9ggIVFeM"} data: [DONE] @@ -351,4 +415,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.85971025s + duration: 25.884567375s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/update_a_file.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/update_a_file.yaml index 98d424c8103ad58d863589a46e932049ceb21fa4..a9d51fb1ce4caa0c910048b335bcaa5bb8f0f228 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/update_a_file.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/update_a_file.yaml @@ -24,31 +24,31 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk2sNxS8qBnzj3NLwoDotnH16qYk","object":"chat.completion.chunk","created":1761681202,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"R3Yn6iuW6b8HIG"} + data: {"id":"chatcmpl-CVxg2Ul1F1r6MVIMBv4rGUwO4rh67","object":"chat.completion.chunk","created":1761733602,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"COo8l457OyXcgE"} - data: {"id":"chatcmpl-CVk2sNxS8qBnzj3NLwoDotnH16qYk","object":"chat.completion.chunk","created":1761681202,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"Update"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"QBbkulYf5h"} + data: {"id":"chatcmpl-CVxg2Ul1F1r6MVIMBv4rGUwO4rh67","object":"chat.completion.chunk","created":1761733602,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"Update"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"PSuYFhJBOx"} - data: {"id":"chatcmpl-CVk2sNxS8qBnzj3NLwoDotnH16qYk","object":"chat.completion.chunk","created":1761681202,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" main"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"x0XiJE7rkNR"} + data: {"id":"chatcmpl-CVxg2Ul1F1r6MVIMBv4rGUwO4rh67","object":"chat.completion.chunk","created":1761733602,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" main"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"XTDMk5Dt4vs"} - data: {"id":"chatcmpl-CVk2sNxS8qBnzj3NLwoDotnH16qYk","object":"chat.completion.chunk","created":1761681202,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":".go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"BuBW48ym6MpIH"} + data: {"id":"chatcmpl-CVxg2Ul1F1r6MVIMBv4rGUwO4rh67","object":"chat.completion.chunk","created":1761733602,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":".go"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"Ab1crzsxJ3SVM"} - data: {"id":"chatcmpl-CVk2sNxS8qBnzj3NLwoDotnH16qYk","object":"chat.completion.chunk","created":1761681202,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" to"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"v1imL3nZbF8mI"} + data: {"id":"chatcmpl-CVxg2Ul1F1r6MVIMBv4rGUwO4rh67","object":"chat.completion.chunk","created":1761733602,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" to"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"D8ozuo7RM6KrP"} - data: {"id":"chatcmpl-CVk2sNxS8qBnzj3NLwoDotnH16qYk","object":"chat.completion.chunk","created":1761681202,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Print"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"CoAaUwSdqe"} + data: {"id":"chatcmpl-CVxg2Ul1F1r6MVIMBv4rGUwO4rh67","object":"chat.completion.chunk","created":1761733602,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Print"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"g5f4xAuL7X"} - data: {"id":"chatcmpl-CVk2sNxS8qBnzj3NLwoDotnH16qYk","object":"chat.completion.chunk","created":1761681202,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" '"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"iWfznG6OyaFJ8d"} + data: {"id":"chatcmpl-CVxg2Ul1F1r6MVIMBv4rGUwO4rh67","object":"chat.completion.chunk","created":1761733602,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" \""},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"1yUEywLDO0XRU"} - data: {"id":"chatcmpl-CVk2sNxS8qBnzj3NLwoDotnH16qYk","object":"chat.completion.chunk","created":1761681202,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"pIdJEP2vPX2"} + data: {"id":"chatcmpl-CVxg2Ul1F1r6MVIMBv4rGUwO4rh67","object":"chat.completion.chunk","created":1761733602,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"iV2XJQhI7hw"} - data: {"id":"chatcmpl-CVk2sNxS8qBnzj3NLwoDotnH16qYk","object":"chat.completion.chunk","created":1761681202,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" from"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"910PGerTLOV"} + data: {"id":"chatcmpl-CVxg2Ul1F1r6MVIMBv4rGUwO4rh67","object":"chat.completion.chunk","created":1761733602,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" from"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"3YW0T3Cr6EA"} - data: {"id":"chatcmpl-CVk2sNxS8qBnzj3NLwoDotnH16qYk","object":"chat.completion.chunk","created":1761681202,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Crush"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"6PaKqGDvcY"} + data: {"id":"chatcmpl-CVxg2Ul1F1r6MVIMBv4rGUwO4rh67","object":"chat.completion.chunk","created":1761733602,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Crush"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"TuUrlEUj4X"} - data: {"id":"chatcmpl-CVk2sNxS8qBnzj3NLwoDotnH16qYk","object":"chat.completion.chunk","created":1761681202,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"'"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"9BDcYHO629IKfQk"} + data: {"id":"chatcmpl-CVxg2Ul1F1r6MVIMBv4rGUwO4rh67","object":"chat.completion.chunk","created":1761733602,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"\""},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"usWGbfw0PRJC3O"} - data: {"id":"chatcmpl-CVk2sNxS8qBnzj3NLwoDotnH16qYk","object":"chat.completion.chunk","created":1761681202,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"9RfCvE5WIg"} + data: {"id":"chatcmpl-CVxg2Ul1F1r6MVIMBv4rGUwO4rh67","object":"chat.completion.chunk","created":1761733602,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"z9oIvbznOQ"} - data: {"id":"chatcmpl-CVk2sNxS8qBnzj3NLwoDotnH16qYk","object":"chat.completion.chunk","created":1761681202,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[],"usage":{"prompt_tokens":139,"completion_tokens":10,"total_tokens":149,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"y7sGiCFcujZqp"} + data: {"id":"chatcmpl-CVxg2Ul1F1r6MVIMBv4rGUwO4rh67","object":"chat.completion.chunk","created":1761733602,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[],"usage":{"prompt_tokens":139,"completion_tokens":10,"total_tokens":149,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"7SZ5XrmBfz2kc"} data: [DONE] @@ -57,15 +57,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.055637958s + duration: 1.258785333s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 43994 + content_length: 42705 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -81,61 +81,65 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_8tYBtU6MXPpnD3FOqkT0AUK3","type":"function","function":{"name":"ls","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"iGQ9Qpc3EWmMYb"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_AHec9mWdQ536CLhJSxPwGoK9","type":"function","function":{"name":"ls","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"Mg0QAtutJCt6Ve"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"xF98xthYfOulNJL"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Lx5xCNamMvOErGF"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"UmZEo1SN4IuMdq"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0eO9gZkTpQFS1q"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"HDTLouEZdZe5QBf"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"h9yzlqrLfOoxGrV"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"eAlHUoaCOom7Kmf"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2CApdn0anMTPbO"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"pl36ZDvaThpxhoP"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"FDODzculonKSk1K"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Zs8DZFPlWrmwc3J"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"AQ9kUT6DYxpzmWK"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"K8EmEwpBTfgEvmv"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"x7LOCG89in6GADO"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Afdwc8LcyRBwa"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"5BQjibpGX9vOR"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"XoZQrwREBuTB0"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"k9fE4ohVRlpRt"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"bHlxGMa4eu4Ar"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"GxeeKTHrCA3mT"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"z9bRFIZ4jh7zo"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"KtyNiGhQ0s4re"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"puOHUKYoG5GZE"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7Gz9OM8OW6sVU"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"S"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"S"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Q"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"C"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/update"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Ek4dCmD669I"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/update"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yOgD7EXwEY4"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"mbERBruQ8GglG"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"jmjriBzb8OrN4"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"YsvxnjOQPmhqb"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\","}}]},"finish_reason":null}],"usage":null,"obfuscation":"sWxRiqfzToe20j8"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"depth"}}]},"finish_reason":null}],"usage":null,"obfuscation":"HFXrcQzmptFnZ"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \""}}]},"finish_reason":null}],"usage":null,"obfuscation":"3caREGj3STbaoXs"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"JqQ2fpCRYuV4eiS"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"depth"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9bQfPS4z4GvoU"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"2"}}]},"finish_reason":null}],"usage":null,"obfuscation":"K"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3tA0mWsK66GCYA3"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"R"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" "}}]},"finish_reason":null}],"usage":null,"obfuscation":"n"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"2"}}]},"finish_reason":null}],"usage":null,"obfuscation":"r"} - data: {"id":"chatcmpl-CVk2sDIKki3CZp40vHC8whYZF0POC","object":"chat.completion.chunk","created":1761681202,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9741,"completion_tokens":107,"total_tokens":9848,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":64,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"Uo"} + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"h"} + + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + + data: {"id":"chatcmpl-CVxg2MgD7rhjwDspGfG1Y1vIu9Now","object":"chat.completion.chunk","created":1761733602,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9493,"completion_tokens":45,"total_tokens":9538,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"yHhZFqg"} data: [DONE] @@ -144,15 +148,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 3.716069334s + duration: 4.008910916s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44376 + content_length: 43090 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_8tYBtU6MXPpnD3FOqkT0AUK3\",\"function\":{\"arguments\":\"{\\\"path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\\",\\\"depth\\\":2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_8tYBtU6MXPpnD3FOqkT0AUK3\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_AHec9mWdQ536CLhJSxPwGoK9\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_AHec9mWdQ536CLhJSxPwGoK9\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -168,59 +172,59 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_vjAnn9GCdXD9zsBKAMqzDh3E","type":"function","function":{"name":"view","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"2vnXZ8t13v5T"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_2I6yV7qEBqEtzCYLoIBx18yH","type":"function","function":{"name":"view","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"Y0UfO20I0NH0"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"s8UKUxMh2huBsXi"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"LwkVrc5EQrS0eG0"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"eZb560ChQc1zPi"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"48rJLtN0ii6mNx"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"lDRVF4tAb72xd"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"rzyWEGYoGj4NI"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"F3JVrR4WtgnhrxY"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"HgWkyRppNfeqk0o"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"FEtbLA6bCpNAdUd"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"83reKXZ7ylzCCa7"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8l4xpfl2U1bY6CT"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dFARkSD2mcXp5Mr"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"MqdUmpLEPGeDHLB"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"HVFT3KVuVF0bQ5c"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PvLcvB6KuWTSDmf"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"NlrMO1MJ7pRuL3Q"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"OprFfGaRUrhgA"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4hojOom6tl1vs"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0mnnAAKf0bpJr"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"OYTeHPMTl7aTL"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"UcEQf1ebWfKBy"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"KDoWAD6pRiVnY"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"95eEozNqBIeHC"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xi5kIY0LqLliT"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"NIKZ8DWGfpPBQ"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"R5JatOoIc4LQZ"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"T"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"w"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"d"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/update"}}]},"finish_reason":null}],"usage":null,"obfuscation":"NIIgm46lAJK"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/update"}}]},"finish_reason":null}],"usage":null,"obfuscation":"5gQarvBbzr9"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Yvia8RTo0fpn4"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"5v0wZVJjk8OGJ"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"cn04CJUMBkPHA"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1NQVTIGBZ97Mm"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"vJTdyOMCpGNFygz"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xodavZnaczEfEat"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ERYxZ0oQx7oGgRk"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6eV6pc3BOoRg4H9"} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2wFnguFHsnrhqKcVKPwZCBVdLW","object":"chat.completion.chunk","created":1761681206,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9818,"completion_tokens":35,"total_tokens":9853,"prompt_tokens_details":{"cached_tokens":8832,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"5rpH"} + data: {"id":"chatcmpl-CVxg6dq3orhIH4l5dvkMaenhZDJMk","object":"chat.completion.chunk","created":1761733606,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9570,"completion_tokens":35,"total_tokens":9605,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"tzFR"} data: [DONE] @@ -229,15 +233,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.466241208s + duration: 1.413711084s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44824 + content_length: 43538 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_8tYBtU6MXPpnD3FOqkT0AUK3\",\"function\":{\"arguments\":\"{\\\"path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\\",\\\"depth\\\":2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_8tYBtU6MXPpnD3FOqkT0AUK3\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_vjAnn9GCdXD9zsBKAMqzDh3E\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_vjAnn9GCdXD9zsBKAMqzDh3E\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_AHec9mWdQ536CLhJSxPwGoK9\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_AHec9mWdQ536CLhJSxPwGoK9\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_2I6yV7qEBqEtzCYLoIBx18yH\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_2I6yV7qEBqEtzCYLoIBx18yH\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -253,141 +257,141 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_YGu5J5nJv01YwKhhtlkLoSNo","type":"function","function":{"name":"edit","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"vof4vHotSgeX"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_AcXHYSimMSCVDD6beXceFdUT","type":"function","function":{"name":"edit","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"WBnZGpSTo71x"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"2xDlj9xNBgTI3LU"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"wmsNqwft1B2ZzWR"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ifr42O1pt6x7E0"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Smh2bCVGU813Ea"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Jde7Ctwbynzyr"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"LyN7GlHvMNLOS"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ajk6b20TP2oxO13"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"RvesV7I3jOuKfOX"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"JglbgKUniB61ipE"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"k2FP1ylqMZBkI9z"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"QMSA1gzgUIwtapl"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Vntlnm5kVfb9jwP"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"HkmWDrbXgClIUgx"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"jBV9t9Ie3OU2SDF"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TVUm5CSeTayysrS"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7cttZXmn8QQYqEs"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qJwW52z2YP3Bg"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"cDSdQ7uaQIQwL"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"k3c3z34P3sdXe"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"CUmcwfbeDtjra"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"blJUVKe2ufI6x"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"907XZOFuMSZIW"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"UPMFBuktrlgS6"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"B2BAbT0SKQQcK"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"jXXuX25KTnFnm"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3RvY63Eiqm8oQ"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"b"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"1"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"v"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/update"}}]},"finish_reason":null}],"usage":null,"obfuscation":"oGuVM3bdb84"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/update"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2VAuML8MqKu"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"cytBebGsb9gel"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PUbqjySzFImew"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"TyAzHQkeccf4B"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0zyQ0Tf9zeadG"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"HjXZhw46TIYKgTv"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"IHZi77FCdHvPokA"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"gMSBFc0fFxn17"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"imJ29Q7Q3Rns7"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"old"}}]},"finish_reason":null}],"usage":null,"obfuscation":"CXwEdRifeNxFICP"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"old"}}]},"finish_reason":null}],"usage":null,"obfuscation":"G5CGtHHnPMkI7su"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ePjWkcY9RB4"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ENIjk54T9TP"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"zkrtFuv7xlxjV"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"C59hGunlUgxWV"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"func"}}]},"finish_reason":null}],"usage":null,"obfuscation":"BgXbwYO9XZfKx6"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"func"}}]},"finish_reason":null}],"usage":null,"obfuscation":"IxHPChnqwsr4xz"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"XQAiDoXW8aKbG"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"T9TUbq4XwoW20"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"()"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"()"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" {\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qV5iGUyhTesUuI"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" {\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"zXKh7dZvyuBFf5"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"b"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"D"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\t"}}]},"finish_reason":null}],"usage":null,"obfuscation":"lkj6jop9RHsL61X"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\t"}}]},"finish_reason":null}],"usage":null,"obfuscation":"SYURevWrgXppiTd"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"fmt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"OVG6bu4PSl74ehD"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"fmt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3J8a226jRSNFKQI"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2yesKQ7SPJ"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"SLDwNnOTt0"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"EUH5A5eYBUeFn"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"3MKeDEUD3gLeX"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9xYB3Qa0apoRc"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8u2mnGCW45cnq"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":","}}]},"finish_reason":null}],"usage":null,"obfuscation":"Z"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":","}}]},"finish_reason":null}],"usage":null,"obfuscation":"R"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" World"}}]},"finish_reason":null}],"usage":null,"obfuscation":"lla0zIVV6wwM"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" World"}}]},"finish_reason":null}],"usage":null,"obfuscation":"tykr4pBhpLlP"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"!\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"X7adWaxkzKtA4UQ"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"!\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8Na3beRivOJe6DR"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"pzl8XfQGTRgkftX"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"arQ9dOE63TRui7W"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"d"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"q"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"j"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"J"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"sTcuCE5SVM5P7"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"W8zSnLltHueQB"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"new"}}]},"finish_reason":null}],"usage":null,"obfuscation":"WFtZWBKxJbdeWR0"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"new"}}]},"finish_reason":null}],"usage":null,"obfuscation":"hWdgyHPcHqP4VMG"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ib7xvRgz7Oa"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_string"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Xho4nyAS4S4"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"7l7KfRKhiAtTc"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"VTfP1bf4bFkkQ"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"func"}}]},"finish_reason":null}],"usage":null,"obfuscation":"rKO0MB8vLaOpME"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"func"}}]},"finish_reason":null}],"usage":null,"obfuscation":"FlreKxnA4YhQqC"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"atN4DFn2nk3Oh"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"GlaTWqZVPswLJ"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"()"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"()"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" {\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yLLLVPgwOqVwLU"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" {\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gyvY16jOAGkOvs"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"A"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"j"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\t"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Kzduvk7kSDq7wHq"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\t"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yodHv7RaYKJO4SQ"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"fmt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"GzbK03HBzbyaTuG"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"fmt"}}]},"finish_reason":null}],"usage":null,"obfuscation":"aFNGnzfgAo5mpYg"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"oup8zSbUOg"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".Println"}}]},"finish_reason":null}],"usage":null,"obfuscation":"mUgKeHnfj6"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"b1RShwZoCL8gg"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"(\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"k9T6qlCdhht5H"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"T7hpdeGAm202L"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"hello"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7YRcttci9biBE"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" from"}}]},"finish_reason":null}],"usage":null,"obfuscation":"DDnoFblQ88jhs"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" from"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9WMAYouGwKmph"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" crush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"WCoo2LgVoeIO"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" crush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"nDawbBnkDHet"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"UNUz1cbG5DmjR"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\\")"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kJp3gFgW3lZjs"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"P"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"n"}}]},"finish_reason":null}],"usage":null,"obfuscation":"y"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"U"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"q"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4lMzhJPVSxPHgjr"} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"hvm66rKsOGg42P9"} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk2zjDt283HuPgyWebI18P43lT8C","object":"chat.completion.chunk","created":1761681209,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9915,"completion_tokens":338,"total_tokens":10253,"prompt_tokens_details":{"cached_tokens":9728,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":256,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":""} + data: {"id":"chatcmpl-CVxg8pdlm50kyxMXcdpqubZkpt3l1","object":"chat.completion.chunk","created":1761733608,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9667,"completion_tokens":530,"total_tokens":10197,"prompt_tokens_details":{"cached_tokens":9600,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":448,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":""} data: [DONE] @@ -396,15 +400,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 11.221667666s + duration: 12.575448125s - id: 4 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45391 + content_length: 44105 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_8tYBtU6MXPpnD3FOqkT0AUK3\",\"function\":{\"arguments\":\"{\\\"path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\\",\\\"depth\\\":2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_8tYBtU6MXPpnD3FOqkT0AUK3\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_vjAnn9GCdXD9zsBKAMqzDh3E\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_vjAnn9GCdXD9zsBKAMqzDh3E\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_YGu5J5nJv01YwKhhtlkLoSNo\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\",\\\"old_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\\n}\\\",\\\"new_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"hello from crush\\\\\\\")\\\\n}\\\"}\",\"name\":\"edit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\n\\n\",\"tool_call_id\":\"call_YGu5J5nJv01YwKhhtlkLoSNo\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_AHec9mWdQ536CLhJSxPwGoK9\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_AHec9mWdQ536CLhJSxPwGoK9\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_2I6yV7qEBqEtzCYLoIBx18yH\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_2I6yV7qEBqEtzCYLoIBx18yH\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_AcXHYSimMSCVDD6beXceFdUT\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\",\\\"old_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\\n}\\\",\\\"new_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"hello from crush\\\\\\\")\\\\n}\\\"}\",\"name\":\"edit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\n\\n\",\"tool_call_id\":\"call_AcXHYSimMSCVDD6beXceFdUT\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -420,83 +424,89 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_CVhjDmFG2eGQzP17M15pvHEM","type":"function","function":{"name":"bash","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"gqzy25i6Vbf7"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_7XN5ICjCFkO1AL2bDE159hZP","type":"function","function":{"name":"bash","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"5KoaC63esBgg"} + + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"HxnQaZjkWsKFzlm"} + + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"command"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qY5gGeTkQp7"} + + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"6ipNcSCSFOWGu"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"I8WbOjqQEkA9E5u"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"command"}}]},"finish_reason":null}],"usage":null,"obfuscation":"k1EeYPmLVn9"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" run"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Jdcc93j6RVnzis"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"SCWYDg34KsmD8"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" /"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"go"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7lOYttGHb27XGFt"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" run"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kHcwZwXBXbNORV"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ZMQ1zG6AUtGjvEQ"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" /"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"JACM0CdEyPlQUx5"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"yc4DvqmgQsXZjet"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"UAWkBSXDQlKsp"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6hKSmJ1krfXvB7s"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"5UA6gUI4sod3S"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8XmVnMkVgF7HlBk"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"IEsCnAR1HJVUP"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ZbKk8BQYdnOq0"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"JccGF69f9p4x2"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"y2fWxpJarfglO"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"4bOwc4jPhjSrP"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"s3le1W7zbYNWr"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dKAqwOB3bpO9p"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"BcXB8AuYO9VWV"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"l"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"J"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/update"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Hq4ZvmqD7Wc"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"n"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"x"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"tCirKY1x0U5aO"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/update"}}]},"finish_reason":null}],"usage":null,"obfuscation":"8z92g4H3hpr"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"lmkReMFtogr1s"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_a"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gmMfcogshaoOhTq"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"llZMXCCpgImRD"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"TiPjbwYKWun91"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/main"}}]},"finish_reason":null}],"usage":null,"obfuscation":"qtksv9ZfQS0fX"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"description"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7NkutYj"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"03PVIw2RDFSAt1H"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"RIciU5BBe74RA"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"aY5GE8Y4b5Ivo"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Run"}}]},"finish_reason":null}],"usage":null,"obfuscation":"hIZL4rSpdwNBeKJ"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"description"}}]},"finish_reason":null}],"usage":null,"obfuscation":"SyuSGlZ"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" the"}}]},"finish_reason":null}],"usage":null,"obfuscation":"0JAkwXGBviTazl"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"CPJntXwdOHVK6"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"sMnpjGBxc6SiKES"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Run"}}]},"finish_reason":null}],"usage":null,"obfuscation":"xLQ9stHqSDmUkoL"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" program"}}]},"finish_reason":null}],"usage":null,"obfuscation":"h68QHzlo8E"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" the"}}]},"finish_reason":null}],"usage":null,"obfuscation":"ZlBqDlx0U72lFL"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" to"}}]},"finish_reason":null}],"usage":null,"obfuscation":"RIwhx72EXsRtbVB"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" Go"}}]},"finish_reason":null}],"usage":null,"obfuscation":"pqoVFXNlCfL5RDS"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" ensure"}}]},"finish_reason":null}],"usage":null,"obfuscation":"63zPl3wRwpG"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" program"}}]},"finish_reason":null}],"usage":null,"obfuscation":"HfBjYTEA4D"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" the"}}]},"finish_reason":null}],"usage":null,"obfuscation":"R9o9i4w6mhJkLa"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" to"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6P32IGHKYY07saR"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" change"}}]},"finish_reason":null}],"usage":null,"obfuscation":"p0tKxyusLjb"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" verify"}}]},"finish_reason":null}],"usage":null,"obfuscation":"OfBnJURTtRn"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" builds"}}]},"finish_reason":null}],"usage":null,"obfuscation":"JhssvX8zkvm"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" the"}}]},"finish_reason":null}],"usage":null,"obfuscation":"UvRdNW8OkqYHDX"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" and"}}]},"finish_reason":null}],"usage":null,"obfuscation":"alO1WhKsy0hHJG"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" output"}}]},"finish_reason":null}],"usage":null,"obfuscation":"dRc8Aq7GSsF"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" runs"}}]},"finish_reason":null}],"usage":null,"obfuscation":"hdIsG0kfl1mpV"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kWXsOqaZkZB2ZSa"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"gtu5SFGit5cGzuz"} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk3AuPcGtPm8WCzCErJzPXnGwOJD","object":"chat.completion.chunk","created":1761681220,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":10032,"completion_tokens":48,"total_tokens":10080,"prompt_tokens_details":{"cached_tokens":9728,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"A1"} + data: {"id":"chatcmpl-CVxgLl3TTIWWJPQkNiTKB2NvELLlj","object":"chat.completion.chunk","created":1761733621,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9784,"completion_tokens":51,"total_tokens":9835,"prompt_tokens_details":{"cached_tokens":9472,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"Nhbh"} data: [DONE] @@ -505,15 +515,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.498585084s + duration: 2.389829625s - id: 5 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45842 + content_length: 44572 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_8tYBtU6MXPpnD3FOqkT0AUK3\",\"function\":{\"arguments\":\"{\\\"path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\\",\\\"depth\\\":2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_8tYBtU6MXPpnD3FOqkT0AUK3\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_vjAnn9GCdXD9zsBKAMqzDh3E\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_vjAnn9GCdXD9zsBKAMqzDh3E\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_YGu5J5nJv01YwKhhtlkLoSNo\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\",\\\"old_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\\n}\\\",\\\"new_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"hello from crush\\\\\\\")\\\\n}\\\"}\",\"name\":\"edit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\n\\n\",\"tool_call_id\":\"call_YGu5J5nJv01YwKhhtlkLoSNo\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_CVhjDmFG2eGQzP17M15pvHEM\",\"function\":{\"arguments\":\"{\\\"command\\\":\\\"go run /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\",\\\"description\\\":\\\"Run the Go program to verify the output\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"hello from crush\\n\\n\\n/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\",\"tool_call_id\":\"call_CVhjDmFG2eGQzP17M15pvHEM\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_AHec9mWdQ536CLhJSxPwGoK9\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\\\", \\\"depth\\\": 2}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_AHec9mWdQ536CLhJSxPwGoK9\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_2I6yV7qEBqEtzCYLoIBx18yH\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_2I6yV7qEBqEtzCYLoIBx18yH\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_AcXHYSimMSCVDD6beXceFdUT\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\",\\\"old_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\\n}\\\",\\\"new_string\\\":\\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"hello from crush\\\\\\\")\\\\n}\\\"}\",\"name\":\"edit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\n\\n\",\"tool_call_id\":\"call_AcXHYSimMSCVDD6beXceFdUT\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"call_7XN5ICjCFkO1AL2bDE159hZP\",\"function\":{\"arguments\":\"{\\\"command\\\":\\\"go run /tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file/main.go\\\",\\\"description\\\":\\\"Run the Go program to ensure the change builds and runs\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"hello from crush\\n\\n\\n/tmp/crush-test/TestCoderAgent/openai-gpt-5/update_a_file\",\"tool_call_id\":\"call_7XN5ICjCFkO1AL2bDE159hZP\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -529,13 +539,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk3DP3xjzK9myFonWqVjQGWvUJWN","object":"chat.completion.chunk","created":1761681223,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"3Gb6a0saI2"} + data: {"id":"chatcmpl-CVxgORsNOhfo6o3cFSq97WQK9RFJa","object":"chat.completion.chunk","created":1761733624,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"OdnVgqvR3b"} - data: {"id":"chatcmpl-CVk3DP3xjzK9myFonWqVjQGWvUJWN","object":"chat.completion.chunk","created":1761681223,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Done"},"finish_reason":null}],"usage":null,"obfuscation":"XvnE9Mgm"} + data: {"id":"chatcmpl-CVxgORsNOhfo6o3cFSq97WQK9RFJa","object":"chat.completion.chunk","created":1761733624,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Done"},"finish_reason":null}],"usage":null,"obfuscation":"4ZImWJll"} - data: {"id":"chatcmpl-CVk3DP3xjzK9myFonWqVjQGWvUJWN","object":"chat.completion.chunk","created":1761681223,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"pLZBAb"} + data: {"id":"chatcmpl-CVxgORsNOhfo6o3cFSq97WQK9RFJa","object":"chat.completion.chunk","created":1761733624,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"O15wqq"} - data: {"id":"chatcmpl-CVk3DP3xjzK9myFonWqVjQGWvUJWN","object":"chat.completion.chunk","created":1761681223,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":10116,"completion_tokens":4,"total_tokens":10120,"prompt_tokens_details":{"cached_tokens":9984,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"K1L"} + data: {"id":"chatcmpl-CVxgORsNOhfo6o3cFSq97WQK9RFJa","object":"chat.completion.chunk","created":1761733624,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9871,"completion_tokens":4,"total_tokens":9875,"prompt_tokens_details":{"cached_tokens":8832,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"92clB"} data: [DONE] @@ -544,4 +554,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 1.877300583s + duration: 3.286206s diff --git a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/write_tool.yaml b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/write_tool.yaml index 4dd64ed20bb926ef1a30d8811b38fabe3d3ba521..567800b76d70b612f7112393db0008397a9ba5e9 100644 --- a/internal/agent/testdata/TestCoderAgent/openai-gpt-5/write_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openai-gpt-5/write_tool.yaml @@ -24,23 +24,23 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk6ofJyze27VhqpyyC3LL1WuQUUT","object":"chat.completion.chunk","created":1761681446,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"zMAHXy5Yx0lUqy"} + data: {"id":"chatcmpl-CVxiAs2yjsNkZKfyisdCJpzWC1PyT","object":"chat.completion.chunk","created":1761733734,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"OcEqqziWPD46fi"} - data: {"id":"chatcmpl-CVk6ofJyze27VhqpyyC3LL1WuQUUT","object":"chat.completion.chunk","created":1761681446,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":"Create"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"MX0N0lOkh7"} + data: {"id":"chatcmpl-CVxiAs2yjsNkZKfyisdCJpzWC1PyT","object":"chat.completion.chunk","created":1761733734,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":"Creating"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"JrYNqxQ5"} - data: {"id":"chatcmpl-CVk6ofJyze27VhqpyyC3LL1WuQUUT","object":"chat.completion.chunk","created":1761681446,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" config"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"xEASynL4v"} + data: {"id":"chatcmpl-CVxiAs2yjsNkZKfyisdCJpzWC1PyT","object":"chat.completion.chunk","created":1761733734,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" config"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"ZQtnHQNKI"} - data: {"id":"chatcmpl-CVk6ofJyze27VhqpyyC3LL1WuQUUT","object":"chat.completion.chunk","created":1761681446,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":".json"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"QrwRYsIfwmD"} + data: {"id":"chatcmpl-CVxiAs2yjsNkZKfyisdCJpzWC1PyT","object":"chat.completion.chunk","created":1761733734,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":".json"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"LJB3dk4vWaZ"} - data: {"id":"chatcmpl-CVk6ofJyze27VhqpyyC3LL1WuQUUT","object":"chat.completion.chunk","created":1761681446,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" with"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"Is53hpOzi0t"} + data: {"id":"chatcmpl-CVxiAs2yjsNkZKfyisdCJpzWC1PyT","object":"chat.completion.chunk","created":1761733734,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" with"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"sb0zunw8UpE"} - data: {"id":"chatcmpl-CVk6ofJyze27VhqpyyC3LL1WuQUUT","object":"chat.completion.chunk","created":1761681446,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" JSON"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"BPVemxKv7Jb"} + data: {"id":"chatcmpl-CVxiAs2yjsNkZKfyisdCJpzWC1PyT","object":"chat.completion.chunk","created":1761733734,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Test"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"3j3jGHjFnB2"} - data: {"id":"chatcmpl-CVk6ofJyze27VhqpyyC3LL1WuQUUT","object":"chat.completion.chunk","created":1761681446,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{"content":" Content"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"jdYveAsc"} + data: {"id":"chatcmpl-CVxiAs2yjsNkZKfyisdCJpzWC1PyT","object":"chat.completion.chunk","created":1761733734,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{"content":" Data"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"vlsO150IsiS"} - data: {"id":"chatcmpl-CVk6ofJyze27VhqpyyC3LL1WuQUUT","object":"chat.completion.chunk","created":1761681446,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"QjjaTWqUpr"} + data: {"id":"chatcmpl-CVxiAs2yjsNkZKfyisdCJpzWC1PyT","object":"chat.completion.chunk","created":1761733734,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"NehQtKlmHH"} - data: {"id":"chatcmpl-CVk6ofJyze27VhqpyyC3LL1WuQUUT","object":"chat.completion.chunk","created":1761681446,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_65564d8ba5","choices":[],"usage":{"prompt_tokens":153,"completion_tokens":6,"total_tokens":159,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"1ekL6k70ElsT3D"} + data: {"id":"chatcmpl-CVxiAs2yjsNkZKfyisdCJpzWC1PyT","object":"chat.completion.chunk","created":1761733734,"model":"gpt-4o-2024-08-06","service_tier":"default","system_fingerprint":"fp_cbf1785567","choices":[],"usage":{"prompt_tokens":153,"completion_tokens":6,"total_tokens":159,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"8pyxFjKsPd7DtS"} data: [DONE] @@ -49,15 +49,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 555.366458ms + duration: 641.712416ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44031 + content_length: 42742 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -73,97 +73,97 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_rwKIDgC4o2RSCbrAexSGuBF4","type":"function","function":{"name":"write","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"PK6adXfUibR"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"call_UJ0wNA2wkscBRb47rg2l8SAF","type":"function","function":{"name":"write","arguments":""}}],"refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"rjuiXrhYTAn"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"pJmvWy3euDl66rx"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"otiIsHBV7KorCn9"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"6M9sTAvNRNPrSs"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"file"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kfad4TENMNAgaz"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"VcwHbiNRZXtBT"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_path"}}]},"finish_reason":null}],"usage":null,"obfuscation":"w6k4VY7hTOWdF"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"GSMPujCDDfXzOsR"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"p7qvfVwNNyYAXdr"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Rgc0lzMsupP8Hhg"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"/"}}]},"finish_reason":null}],"usage":null,"obfuscation":"HWU7dw1NGpeNg2R"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"UIAuUDC5LA7ZFjH"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"tmp"}}]},"finish_reason":null}],"usage":null,"obfuscation":"C8H22zcgkSslnh4"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"h6e6ngHcL9JHqpb"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/cr"}}]},"finish_reason":null}],"usage":null,"obfuscation":"AFiaGgGCD3PPXSR"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"InrBbdTcH0lVnfm"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ush"}}]},"finish_reason":null}],"usage":null,"obfuscation":"CT55SHbfU3flrKu"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"7eucEAdLXDaAl"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Y7MDJFx7oC1qD"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"su5iUmNrXRL0E"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/Test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"U2iNTvwi4gAdS"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"mSs1iIwcR7nEI"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Coder"}}]},"finish_reason":null}],"usage":null,"obfuscation":"sbRxAN1uTDSRR"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9u9dhv3G7DK3I"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"Agent"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Uao5JSvRP7I2Q"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"iKZqtZiqQJ8kw"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/open"}}]},"finish_reason":null}],"usage":null,"obfuscation":"kpfMmc5RPCjKt"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ai"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-g"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"pt"}}]},"finish_reason":null}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"V"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"-"}}]},"finish_reason":null}],"usage":null,"obfuscation":"L"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"O"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"5"}}]},"finish_reason":null}],"usage":null,"obfuscation":"c"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/write"}}]},"finish_reason":null}],"usage":null,"obfuscation":"72YSNyLUOOOn"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/write"}}]},"finish_reason":null}],"usage":null,"obfuscation":"3qy427I6oqO8"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Q09jiJ74Slv5v"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"_tool"}}]},"finish_reason":null}],"usage":null,"obfuscation":"peWDPqjSaMz83"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/config"}}]},"finish_reason":null}],"usage":null,"obfuscation":"iR75qL8FZLF"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"/config"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Yu5geIlnydZ"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".json"}}]},"finish_reason":null}],"usage":null,"obfuscation":"04fq7MTL1GJtd"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":".json"}}]},"finish_reason":null}],"usage":null,"obfuscation":"im72dR4UEAcxw"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"Hosshi9vzA3nr"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\",\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"rMzrXOg8BvYDZ"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"content"}}]},"finish_reason":null}],"usage":null,"obfuscation":"SobXY6UAj7w"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"content"}}]},"finish_reason":null}],"usage":null,"obfuscation":"g62XyHaP6YA"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"m2vOBmneDNHB9"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"vWMykJ6scRUVP"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"tDHLYMUKrbKkW"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"{\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"IXZdDS6ZqRA8o"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"name"}}]},"finish_reason":null}],"usage":null,"obfuscation":"PmgpLw1Qw3gWdS"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"name"}}]},"finish_reason":null}],"usage":null,"obfuscation":"CwnVJ0dqt1mUyv"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"GhY6uVpB9NdlV"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"EX6vP85bSqHqM"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"9NGI0SaOZc0t3"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"OmY5cBAoAFHD8"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"9RNhpNsfudBRXN"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"test"}}]},"finish_reason":null}],"usage":null,"obfuscation":"62jul5geYOKtdX"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\\","}}]},"finish_reason":null}],"usage":null,"obfuscation":"WTFGx2M595hWJ"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\\","}}]},"finish_reason":null}],"usage":null,"obfuscation":"f9EhhlJDcmNzN"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"AjQSP5R57Sucw"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"08yCYr6ErzWbY"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"version"}}]},"finish_reason":null}],"usage":null,"obfuscation":"T62m2yFfyTq"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"version"}}]},"finish_reason":null}],"usage":null,"obfuscation":"pQUkUwAXV0J"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Nc20NjjtNH3Qv"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\\":"}}]},"finish_reason":null}],"usage":null,"obfuscation":"egKCa7v7k4mX8"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"bsGzWX1eN0FH6"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"0TMqSjuSZfJ6w"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"1"}}]},"finish_reason":null}],"usage":null,"obfuscation":"l"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"1"}}]},"finish_reason":null}],"usage":null,"obfuscation":"X"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"."}}]},"finish_reason":null}],"usage":null,"obfuscation":"q"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"."}}]},"finish_reason":null}],"usage":null,"obfuscation":"U"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"0"}}]},"finish_reason":null}],"usage":null,"obfuscation":"Z"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"0"}}]},"finish_reason":null}],"usage":null,"obfuscation":"2"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"."}}]},"finish_reason":null}],"usage":null,"obfuscation":"m"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"."}}]},"finish_reason":null}],"usage":null,"obfuscation":"F"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"0"}}]},"finish_reason":null}],"usage":null,"obfuscation":"y"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"0"}}]},"finish_reason":null}],"usage":null,"obfuscation":"A"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"fMaKKKDLHhl2pl"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\\\""}}]},"finish_reason":null}],"usage":null,"obfuscation":"gEhD91Yf63LPLP"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"F"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"l"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"rWMjvfq3QBvu3hr"} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]},"finish_reason":null}],"usage":null,"obfuscation":"52jeg9Y9i0BAENu"} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}],"usage":null,"obfuscation":""} - data: {"id":"chatcmpl-CVk6osKtykleRBgBngusjx5PiJamp","object":"chat.completion.chunk","created":1761681446,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9755,"completion_tokens":636,"total_tokens":10391,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":576,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":""} + data: {"id":"chatcmpl-CVxiACtWsyetLoZgMbH0pwHDQWZzJ","object":"chat.completion.chunk","created":1761733734,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9507,"completion_tokens":892,"total_tokens":10399,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":832,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":""} data: [DONE] @@ -172,15 +172,15 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 12.357447833s + duration: 22.070237958s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44520 + content_length: 43231 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_rwKIDgC4o2RSCbrAexSGuBF4\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/write_tool/config.json\\\",\\\"content\\\":\\\"{\\\\\\\"name\\\\\\\": \\\\\\\"test\\\\\\\", \\\\\\\"version\\\\\\\": \\\\\\\"1.0.0\\\\\\\"}\\\"}\",\"name\":\"write\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nFile successfully written: /tmp/crush-test/TestCoderAgent/openai-gpt-5/write_tool/config.json\\n\",\"tool_call_id\":\"call_rwKIDgC4o2RSCbrAexSGuBF4\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openai-gpt-5/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"call_UJ0wNA2wkscBRb47rg2l8SAF\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openai-gpt-5/write_tool/config.json\\\",\\\"content\\\":\\\"{\\\\\\\"name\\\\\\\": \\\\\\\"test\\\\\\\", \\\\\\\"version\\\\\\\": \\\\\\\"1.0.0\\\\\\\"}\\\"}\",\"name\":\"write\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nFile successfully written: /tmp/crush-test/TestCoderAgent/openai-gpt-5/write_tool/config.json\\n\",\"tool_call_id\":\"call_UJ0wNA2wkscBRb47rg2l8SAF\",\"role\":\"tool\"}],\"model\":\"gpt-5\",\"max_completion_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -196,13 +196,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"chatcmpl-CVk719cxPY4UPWy5RlFDaLQ6mGzEA","object":"chat.completion.chunk","created":1761681459,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"IeodT7RAbp"} + data: {"id":"chatcmpl-CVxiXeiFOKwGrYlFgrgDpRR77GRyA","object":"chat.completion.chunk","created":1761733757,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"finish_reason":null}],"usage":null,"obfuscation":"BnlghWWDwC"} - data: {"id":"chatcmpl-CVk719cxPY4UPWy5RlFDaLQ6mGzEA","object":"chat.completion.chunk","created":1761681459,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Done"},"finish_reason":null}],"usage":null,"obfuscation":"ptI1l0nd"} + data: {"id":"chatcmpl-CVxiXeiFOKwGrYlFgrgDpRR77GRyA","object":"chat.completion.chunk","created":1761733757,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"Done"},"finish_reason":null}],"usage":null,"obfuscation":"MIgq7mas"} - data: {"id":"chatcmpl-CVk719cxPY4UPWy5RlFDaLQ6mGzEA","object":"chat.completion.chunk","created":1761681459,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"ciyvmR"} + data: {"id":"chatcmpl-CVxiXeiFOKwGrYlFgrgDpRR77GRyA","object":"chat.completion.chunk","created":1761733757,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":null,"obfuscation":"zkK3n5"} - data: {"id":"chatcmpl-CVk719cxPY4UPWy5RlFDaLQ6mGzEA","object":"chat.completion.chunk","created":1761681459,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9848,"completion_tokens":4,"total_tokens":9852,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"2bXsA"} + data: {"id":"chatcmpl-CVxiXeiFOKwGrYlFgrgDpRR77GRyA","object":"chat.completion.chunk","created":1761733757,"model":"gpt-5-2025-08-07","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":9600,"completion_tokens":4,"total_tokens":9604,"prompt_tokens_details":{"cached_tokens":2688,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"IrDqf"} data: [DONE] @@ -211,4 +211,4 @@ interactions: - text/event-stream; charset=utf-8 status: 200 OK code: 200 - duration: 2.136835083s + duration: 1.96974625s diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/bash_tool.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/bash_tool.yaml index 680c5ba103c3bb194ecd41bb40eb83013dfe230e..bfb3570096749d22da108c4df8ba6e512c3a3c05 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/bash_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/bash_tool.yaml @@ -24,21 +24,23 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761683188-6tgZOupTkCMjXNJ4X5p8","provider":"Hyperbolic","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761683188,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733808-gWYFVsD8O5jlSK47iImH","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761683188-6tgZOupTkCMjXNJ4X5p8","provider":"Hyperbolic","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761683188,"choices":[{"index":0,"delta":{"role":"assistant","content":"Create"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733808-gWYFVsD8O5jlSK47iImH","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761683188-6tgZOupTkCMjXNJ4X5p8","provider":"Hyperbolic","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761683188,"choices":[{"index":0,"delta":{"role":"assistant","content":" test"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733808-gWYFVsD8O5jlSK47iImH","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":"Create"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761683188-6tgZOupTkCMjXNJ4X5p8","provider":"Hyperbolic","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761683188,"choices":[{"index":0,"delta":{"role":"assistant","content":".txt with"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733808-gWYFVsD8O5jlSK47iImH","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":" test"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761683188-6tgZOupTkCMjXNJ4X5p8","provider":"Hyperbolic","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761683188,"choices":[{"index":0,"delta":{"role":"assistant","content":" hello bash using"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733808-gWYFVsD8O5jlSK47iImH","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":".txt with"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761683188-6tgZOupTkCMjXNJ4X5p8","provider":"Hyperbolic","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761683188,"choices":[{"index":0,"delta":{"role":"assistant","content":" bash"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733808-gWYFVsD8O5jlSK47iImH","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":" hello bash using"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761683188-6tgZOupTkCMjXNJ4X5p8","provider":"Hyperbolic","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761683188,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761733808-gWYFVsD8O5jlSK47iImH","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":" bash"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761683188-6tgZOupTkCMjXNJ4X5p8","provider":"Hyperbolic","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761683188,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":147,"completion_tokens":9,"total_tokens":156,"cost":0.0000468,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000441,"upstream_inference_completions_cost":0.0000027},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733808-gWYFVsD8O5jlSK47iImH","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1761733808-gWYFVsD8O5jlSK47iImH","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":147,"completion_tokens":9,"total_tokens":156,"cost":0.00003048,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00002058,"upstream_inference_completions_cost":0.0000099},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -47,15 +49,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 2.295061208s + duration: 589.636459ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44127 + content_length: 42838 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'. do not print its timestamp\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'. do not print its timestamp\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -71,11 +73,67 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761683188-kcfO02EpF8n7OfTbuOyH","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761683188,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.bash:0","index":0,"type":"function","function":{"name":"bash","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"command"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"echo"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" '"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"hello"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" bash"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"'"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" >"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".txt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\","}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"description"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761683188-kcfO02EpF8n7OfTbuOyH","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761683188,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.bash:0","function":{"arguments":"{\"command\": \"> test.txt && echo 'hello bash' > test.txt\", \"description\": \"Create test.txt with 'hello bash' content without timestamp\"}","name":"bash"},"type":"function"}]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761683188-kcfO02EpF8n7OfTbuOyH","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761683188,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":11074,"completion_tokens":36,"total_tokens":11110,"cost":0.005609,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.005537,"upstream_inference_completions_cost":0.000072},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Create"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".txt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" with"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" the"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" content"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" '"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"hello"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" bash"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"'"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1761733808-H56MTOteqnFyOhnI05Ag","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733808,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":9889,"completion_tokens":39,"total_tokens":9928,"cost":0.00555556,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00543895,"upstream_inference_completions_cost":0.00011661},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -84,15 +142,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.985102917s + duration: 957.039417ms - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44464 + content_length: 43147 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'. do not print its timestamp\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.bash:0\",\"function\":{\"arguments\":\"{\\\"command\\\": \\\"> test.txt && echo 'hello bash' > test.txt\\\", \\\"description\\\": \\\"Create test.txt with 'hello bash' content without timestamp\\\"}\",\"name\":\"bash\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"no output\",\"tool_call_id\":\"functions.bash:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'. do not print its timestamp\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.bash:0\",\"function\":{\"arguments\":\"{\\\"command\\\": \\\"echo 'hello bash' > test.txt\\\", \\\"description\\\": \\\"Create test.txt with the content 'hello bash'\\\"}\",\"name\":\"bash\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"no output\",\"tool_call_id\":\"functions.bash:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -108,13 +166,66 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761683191-9Pk7EqoqbBXHy3YV3Nxi","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761683191,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733810-YIRwUwyADtSgItBtpkfO","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733810,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733810-YIRwUwyADtSgItBtpkfO","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733810,"choices":[{"index":0,"delta":{"role":"assistant","content":"Done"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733810-YIRwUwyADtSgItBtpkfO","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733810,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733810-YIRwUwyADtSgItBtpkfO","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733810,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.ls:1","index":0,"type":"function","function":{"name":"ls","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733810-YIRwUwyADtSgItBtpkfO","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733810,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"path\": \".\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733810-YIRwUwyADtSgItBtpkfO","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733810,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1761733810-YIRwUwyADtSgItBtpkfO","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733810,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10216,"completion_tokens":18,"total_tokens":10234,"cost":0.01027,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.010216,"upstream_inference_completions_cost":0.000054},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 2.629431916s +- id: 3 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 43466 + host: "" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'. do not print its timestamp\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.bash:0\",\"function\":{\"arguments\":\"{\\\"command\\\": \\\"echo 'hello bash' > test.txt\\\", \\\"description\\\": \\\"Create test.txt with the content 'hello bash'\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"no output\",\"tool_call_id\":\"functions.bash:0\",\"role\":\"tool\"},{\"content\":\"Done.\",\"tool_calls\":[{\"id\":\"functions.ls:1\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\".\\\"}\",\"name\":\"ls\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/bash_tool/\\n - go.mod\\n - main.go\\n - test.txt\\n\",\"tool_call_id\":\"functions.ls:1\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.7.1 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1761733813-2RmpKWdFWXR3Q3bDmsqr","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733813,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733813-2RmpKWdFWXR3Q3bDmsqr","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733813,"choices":[{"index":0,"delta":{"role":"assistant","content":"Created"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733813-2RmpKWdFWXR3Q3bDmsqr","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733813,"choices":[{"index":0,"delta":{"role":"assistant","content":" test"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733813-2RmpKWdFWXR3Q3bDmsqr","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733813,"choices":[{"index":0,"delta":{"role":"assistant","content":".txt"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733813-2RmpKWdFWXR3Q3bDmsqr","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733813,"choices":[{"index":0,"delta":{"role":"assistant","content":" successfully"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761683191-9Pk7EqoqbBXHy3YV3Nxi","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761683191,"choices":[{"index":0,"delta":{"role":"assistant","content":"Done"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733813-2RmpKWdFWXR3Q3bDmsqr","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733813,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761683191-9Pk7EqoqbBXHy3YV3Nxi","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761683191,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733813-2RmpKWdFWXR3Q3bDmsqr","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733813,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761683191-9Pk7EqoqbBXHy3YV3Nxi","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761683191,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10297,"completion_tokens":1,"total_tokens":10298,"cost":0.0041208,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0041188,"upstream_inference_completions_cost":0.000002},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733813-2RmpKWdFWXR3Q3bDmsqr","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733813,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10013,"completion_tokens":6,"total_tokens":10019,"cost":0.00391647,"is_byok":false,"prompt_tokens_details":{"cached_tokens":9792,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00390507,"upstream_inference_completions_cost":0.0000114},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -123,4 +234,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 4.805191375s + duration: 1.160194125s diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/download_tool.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/download_tool.yaml index 620ea2764c2144fd04c9fbb27935fc4c5fb75a9d..3ea69619e78d35bfadc5f68cd801d0727ebedf69 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/download_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/download_tool.yaml @@ -6,9 +6,9 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44152 + content_length: 824 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\ndownload the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\n \n\n","role":"user"}],"model":"qwen/qwen3-next-80b-a3b-instruct","max_tokens":40,"stream_options":{"include_usage":true},"usage":{"include":true},"stream":true}' headers: Accept: - application/json @@ -24,63 +24,80 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.download:0","index":0,"type":"function","function":{"name":"download","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"url"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733814-zptGksGigu7PlbaRXl28","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733814-zptGksGigu7PlbaRXl28","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"https"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733814-zptGksGigu7PlbaRXl28","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":"Download"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"://"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733814-zptGksGigu7PlbaRXl28","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":" and save example.txt"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"example"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733814-zptGksGigu7PlbaRXl28","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":" from example-files"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-files"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733814-zptGksGigu7PlbaRXl28","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":".online"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".online"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733814-zptGksGigu7PlbaRXl28","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":"-"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-con"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733814-zptGksGigu7PlbaRXl28","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":"convert.com"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"vert"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733814-zptGksGigu7PlbaRXl28","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".com"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733814-zptGksGigu7PlbaRXl28","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":150,"completion_tokens":13,"total_tokens":163,"cost":0.0000353,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.000021,"upstream_inference_completions_cost":0.0000143},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/document"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"txt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/example"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: [DONE] - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".txt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 683.878584ms +- id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 42863 + host: "" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.7.1 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1761733814-iRpg5wrenybXMnqAuNbB","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\","}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733814-iRpg5wrenybXMnqAuNbB","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.download:0","index":0,"type":"function","function":{"name":"download","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733814-iRpg5wrenybXMnqAuNbB","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"url\": \"https://example-files.online"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"file"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733814-iRpg5wrenybXMnqAuNbB","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-convert.com/document/txt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733814-iRpg5wrenybXMnqAuNbB","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/example.txt\", \"file_path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733814-iRpg5wrenybXMnqAuNbB","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\": \"/"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733814-iRpg5wrenybXMnqAuNbB","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tmp/crush-test/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"example"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733814-iRpg5wrenybXMnqAuNbB","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"CoderAgent/openrouter-kimi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".txt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733814-iRpg5wrenybXMnqAuNbB","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k2/download_tool/example.txt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733814-iRpg5wrenybXMnqAuNbB","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761733814-iRpg5wrenybXMnqAuNbB","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} - data: {"id":"gen-1761684339-PszwnEW6UMC80CHsU5nq","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684339,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10162,"completion_tokens":36,"total_tokens":10198,"cost":0.00569674,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0055891,"upstream_inference_completions_cost":0.00010764},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733814-iRpg5wrenybXMnqAuNbB","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733814,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10160,"completion_tokens":51,"total_tokens":10211,"cost":0.010313,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.01016,"upstream_inference_completions_cost":0.000153},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -89,8 +106,8 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 2.541596208s -- id: 1 + duration: 852.158708ms +- id: 2 request: proto: HTTP/1.1 proto_major: 1 @@ -135,15 +152,15 @@ interactions: - text/plain; charset=UTF-8 status: 200 OK code: 200 - duration: 175.302708ms -- id: 2 + duration: 183.7515ms +- id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 824 + content_length: 43327 host: "" - body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\ndownload the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\n \n\n","role":"user"}],"model":"qwen/qwen3-next-80b-a3b-instruct","max_tokens":40,"stream_options":{"include_usage":true},"usage":{"include":true},"stream":true}' + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.download:0\",\"function\":{\"arguments\":\"{\\\"url\\\": \\\"https://example-files.online-convert.com/document/txt/example.txt\\\", \\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/download_tool/example.txt\\\"}\",\"name\":\"download\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"Successfully downloaded 2574 bytes to example.txt (Content-Type: text/plain; charset=UTF-8)\",\"tool_call_id\":\"functions.download:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -159,64 +176,29 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761684341-0M3bgfFvFTXjtT2O3EO1","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761684341,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733815-Xy4QGrUpISAouuAtkC1k","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733815,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684341-0M3bgfFvFTXjtT2O3EO1","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761684341,"choices":[{"index":0,"delta":{"role":"assistant","content":"Download"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733815-Xy4QGrUpISAouuAtkC1k","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733815,"choices":[{"index":0,"delta":{"role":"assistant","content":"Download"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684341-0M3bgfFvFTXjtT2O3EO1","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761684341,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733815-Xy4QGrUpISAouuAtkC1k","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733815,"choices":[{"index":0,"delta":{"role":"assistant","content":"ed"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684341-0M3bgfFvFTXjtT2O3EO1","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761684341,"choices":[{"index":0,"delta":{"role":"assistant","content":" save"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733815-Xy4QGrUpISAouuAtkC1k","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733815,"choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684341-0M3bgfFvFTXjtT2O3EO1","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761684341,"choices":[{"index":0,"delta":{"role":"assistant","content":" example"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733815-Xy4QGrUpISAouuAtkC1k","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733815,"choices":[{"index":0,"delta":{"role":"assistant","content":"257"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684341-0M3bgfFvFTXjtT2O3EO1","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761684341,"choices":[{"index":0,"delta":{"role":"assistant","content":".txt"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733815-Xy4QGrUpISAouuAtkC1k","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733815,"choices":[{"index":0,"delta":{"role":"assistant","content":"4"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684341-0M3bgfFvFTXjtT2O3EO1","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761684341,"choices":[{"index":0,"delta":{"role":"assistant","content":" from"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733815-Xy4QGrUpISAouuAtkC1k","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733815,"choices":[{"index":0,"delta":{"role":"assistant","content":" bytes"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684341-0M3bgfFvFTXjtT2O3EO1","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761684341,"choices":[{"index":0,"delta":{"role":"assistant","content":" given"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733815-Xy4QGrUpISAouuAtkC1k","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733815,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684341-0M3bgfFvFTXjtT2O3EO1","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761684341,"choices":[{"index":0,"delta":{"role":"assistant","content":" URL"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761684341-0M3bgfFvFTXjtT2O3EO1","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761684341,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - - data: {"id":"gen-1761684341-0M3bgfFvFTXjtT2O3EO1","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761684341,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":150,"completion_tokens":9,"total_tokens":159,"cost":0.0000249,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.000015,"upstream_inference_completions_cost":0.0000099},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} - - data: [DONE] + data: {"id":"gen-1761733815-Xy4QGrUpISAouuAtkC1k","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733815,"choices":[{"index":0,"delta":{"role":"assistant","content":" example"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - headers: - Content-Type: - - text/event-stream - status: 200 OK - code: 200 - duration: 5.018152625s -- id: 3 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 44552 - host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.download:0\",\"function\":{\"arguments\":\"{\\\"url\\\": \\\"https://example-files.online-convert.com/document/txt/example.txt\\\", \\\"file_path\\\": \\\"example.txt\\\"}\",\"name\":\"download\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"Successfully downloaded 2574 bytes to example.txt (Content-Type: text/plain; charset=UTF-8)\",\"tool_call_id\":\"functions.download:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://openrouter.ai/api/v1/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"gen-1761684344-g7nvE5OpZIHAdXkVSFxK","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684344,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733815-Xy4QGrUpISAouuAtkC1k","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733815,"choices":[{"index":0,"delta":{"role":"assistant","content":".txt"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761684344-g7nvE5OpZIHAdXkVSFxK","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684344,"choices":[{"index":0,"delta":{"role":"assistant","content":"Done. The file has been downloaded and saved as `example.txt` in the current directory."},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761733815-Xy4QGrUpISAouuAtkC1k","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733815,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761684344-g7nvE5OpZIHAdXkVSFxK","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761684344,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10321,"completion_tokens":19,"total_tokens":10340,"cost":0.0051985,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0051605,"upstream_inference_completions_cost":0.000038},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733815-Xy4QGrUpISAouuAtkC1k","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733815,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":9979,"completion_tokens":10,"total_tokens":9989,"cost":0.00391081,"is_byok":false,"prompt_tokens_details":{"cached_tokens":9792,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00389181,"upstream_inference_completions_cost":0.000019},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -225,4 +207,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.455615167s + duration: 715.668459ms diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/fetch_tool.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/fetch_tool.yaml deleted file mode 100644 index c8ee8b0c97b569a3a6a85800921bb4d4d516f156..0000000000000000000000000000000000000000 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/fetch_tool.yaml +++ /dev/null @@ -1,304 +0,0 @@ ---- -version: 2 -interactions: -- id: 0 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 845 - host: "" - body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nfetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word ''John Doe''\n \n\n","role":"user"}],"model":"qwen/qwen3-next-80b-a3b-instruct","max_tokens":40,"stream_options":{"include_usage":true},"usage":{"include":true},"stream":true}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://openrouter.ai/api/v1/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"gen-1761681516-yyGVaFT8oJ7zCV0iCfTI","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681516,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681516-yyGVaFT8oJ7zCV0iCfTI","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681516,"choices":[{"index":0,"delta":{"role":"assistant","content":"Check"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681516-yyGVaFT8oJ7zCV0iCfTI","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681516,"choices":[{"index":0,"delta":{"role":"assistant","content":" if example"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681516-yyGVaFT8oJ7zCV0iCfTI","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681516,"choices":[{"index":0,"delta":{"role":"assistant","content":".html contains John"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681516-yyGVaFT8oJ7zCV0iCfTI","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681516,"choices":[{"index":0,"delta":{"role":"assistant","content":" Doe"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681516-yyGVaFT8oJ7zCV0iCfTI","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681516,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - - data: {"id":"gen-1761681516-yyGVaFT8oJ7zCV0iCfTI","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681516,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":155,"completion_tokens":8,"total_tokens":163,"cost":0.00003525,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00002325,"upstream_inference_completions_cost":0.000012},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} - - data: [DONE] - - headers: - Content-Type: - - text/event-stream - status: 200 OK - code: 200 - duration: 962.130167ms -- id: 1 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 44170 - host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"fetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word 'John Doe'\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://openrouter.ai/api/v1/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"gen-1761681516-KhTFJz7mtcbxBMecKveM","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681517,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681516-KhTFJz7mtcbxBMecKveM","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681517,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.fetch:0","function":{"arguments":"{\"format\": \", \", \"url\": \"https://example-files.online-convert.com/website/html/example.html\"}","name":"fetch"},"type":"function"}]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} - - data: {"id":"gen-1761681516-KhTFJz7mtcbxBMecKveM","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681517,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":11085,"completion_tokens":25,"total_tokens":11110,"cost":0.0055925,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0055425,"upstream_inference_completions_cost":0.00005},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} - - data: [DONE] - - headers: - Content-Type: - - text/event-stream - status: 200 OK - code: 200 - duration: 1.917646166s -- id: 2 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 44502 - host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"fetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word 'John Doe'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.fetch:0\",\"function\":{\"arguments\":\"{\\\"format\\\": \\\", \\\", \\\"url\\\": \\\"https://example-files.online-convert.com/website/html/example.html\\\"}\",\"name\":\"fetch\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"Format must be one of: text, markdown, html\",\"tool_call_id\":\"functions.fetch:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://openrouter.ai/api/v1/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.fetch:1","index":0,"type":"function","function":{"name":"fetch","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"format"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"text"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\","}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"url"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"https"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"://"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"example"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-files"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".online"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-con"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"vert"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".com"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"website"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/html"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/example"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".html"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} - - data: {"id":"gen-1761681519-f8xZtJOkZeDK5ZQtrVtk","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681519,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10228,"completion_tokens":34,"total_tokens":10262,"cost":0.0062218,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0061368,"upstream_inference_completions_cost":0.000085},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} - - data: [DONE] - - headers: - Content-Type: - - text/event-stream - status: 200 OK - code: 200 - duration: 1.244788333s -- id: 3 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 0 - host: example-files.online-convert.com - headers: - User-Agent: - - crush/1.0 - url: https://example-files.online-convert.com/website/html/example.html - method: GET - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - uncompressed: true - body: |- - - - - - -

HTML test file

- -

Purpose: Provide example of this file type
- Document file type: HTML
- Version: 1.0
- Remark:

- -

- - Example content:
- The names "John Doe" for males, "Jane Doe" or "Jane Roe" for females, or "Jonnie Doe" and "Janie Doe" for children, or just "Doe" non-gender-specifically are used as placeholder names for a party whose true identity is unknown or must be withheld in a legal action, case, or discussion. The names are also used to refer to acorpse or hospital patient whose identity is unknown. This practice is widely used in the United States and Canada, but is rarely used in other English-speaking countries including the United Kingdom itself, from where the use of "John Doe" in a legal context originates. The names Joe Bloggs or John Smith are used in the UK instead, as well as in Australia and New Zealand.

- -

John Doe is sometimes used to refer to a typical male in other contexts as well, in a similar manner to John Q. Public, known in Great Britain as Joe Public, John Smith or Joe Bloggs. For example, the first name listed on a form is often John Doe, along with a fictional address or other fictional information to provide an example of how to fill in the form. The name is also used frequently in popular culture, for example in the Frank Capra film Meet John Doe. John Doe was also the name of a 2002 American television series.

- -

Similarly, a child or baby whose identity is unknown may be referred to as Baby Doe. A notorious murder case in Kansas City, Missouri, referred to the baby victim as Precious Doe. Other unidentified female murder victims are Cali Doe and Princess Doe. Additional persons may be called James Doe, Judy Doe, etc. However, to avoid possible confusion, if two anonymous or unknown parties are cited in a specific case or action, the surnames Doe and Roe may be used simultaneously; for example, "John Doe v. Jane Roe". If several anonymous parties are referenced, they may simply be labelled John Doe #1, John Doe #2, etc. (the U.S. Operation Delego cited 21 (numbered) "John Doe"s) or labelled with other variants of Doe / Roe / Poe / etc. Other early alternatives such as John Stiles and Richard Miles are now rarely used, and Mary Major has been used in some American federal cases.

- -

- - File created by https://www.online-convert.com
- More example files: https://www.online-convert.com/file-type
- Text of "Example content": Wikipedia
- License: Attribution-ShareAlike 3.0 Unported - -

- -

Feel free to use and share the file according to license above.

- - - - headers: - Content-Type: - - text/html; charset=UTF-8 - status: 200 OK - code: 200 - duration: 292.716875ms -- id: 4 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 47298 - host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"fetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word 'John Doe'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.fetch:0\",\"function\":{\"arguments\":\"{\\\"format\\\": \\\", \\\", \\\"url\\\": \\\"https://example-files.online-convert.com/website/html/example.html\\\"}\",\"name\":\"fetch\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Format must be one of: text, markdown, html\",\"tool_call_id\":\"functions.fetch:0\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"functions.fetch:1\",\"function\":{\"arguments\":\"{\\\"format\\\": \\\"text\\\", \\\"url\\\": \\\"https://example-files.online-convert.com/website/html/example.html\\\"}\",\"name\":\"fetch\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"HTML test file Purpose: Provide example of this file type Document file type: HTML Version: 1.0 Remark: Example content: The names \\\"John Doe\\\" for males, \\\"Jane Doe\\\" or \\\"Jane Roe\\\" for females, or \\\"Jonnie Doe\\\" and \\\"Janie Doe\\\" for children, or just \\\"Doe\\\" non-gender-specifically are used as placeholder names for a party whose true identity is unknown or must be withheld in a legal action, case, or discussion. The names are also used to refer to acorpse or hospital patient whose identity is unknown. This practice is widely used in the United States and Canada, but is rarely used in other English-speaking countries including the United Kingdom itself, from where the use of \\\"John Doe\\\" in a legal context originates. The names Joe Bloggs or John Smith are used in the UK instead, as well as in Australia and New Zealand. John Doe is sometimes used to refer to a typical male in other contexts as well, in a similar manner to John Q. Public, known in Great Britain as Joe Public, John Smith or Joe Bloggs. For example, the first name listed on a form is often John Doe, along with a fictional address or other fictional information to provide an example of how to fill in the form. The name is also used frequently in popular culture, for example in the Frank Capra film Meet John Doe. John Doe was also the name of a 2002 American television series. Similarly, a child or baby whose identity is unknown may be referred to as Baby Doe. A notorious murder case in Kansas City, Missouri, referred to the baby victim as Precious Doe. Other unidentified female murder victims are Cali Doe and Princess Doe. Additional persons may be called James Doe, Judy Doe, etc. However, to avoid possible confusion, if two anonymous or unknown parties are cited in a specific case or action, the surnames Doe and Roe may be used simultaneously; for example, \\\"John Doe v. Jane Roe\\\". If several anonymous parties are referenced, they may simply be labelled John Doe #1, John Doe #2, etc. (the U.S. Operation Delego cited 21 (numbered) \\\"John Doe\\\"s) or labelled with other variants of Doe / Roe / Poe / etc. Other early alternatives such as John Stiles and Richard Miles are now rarely used, and Mary Major has been used in some American federal cases. File created by https://www.online-convert.com More example files: https://www.online-convert.com/file-type Text of \\\"Example content\\\": Wikipedia License: Attribution-ShareAlike 3.0 Unported Feel free to use and share the file according to license above.\",\"tool_call_id\":\"functions.fetch:1\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://openrouter.ai/api/v1/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"gen-1761681521-VDbhrTwMjCcpzHXdzNr7","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681522,"choices":[{"index":0,"delta":{"role":"assistant","content":"Yes"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - - data: {"id":"gen-1761681521-VDbhrTwMjCcpzHXdzNr7","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681522,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - - data: {"id":"gen-1761681521-VDbhrTwMjCcpzHXdzNr7","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681522,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - - data: {"id":"gen-1761681521-VDbhrTwMjCcpzHXdzNr7","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681522,"choices":[{"index":0,"delta":{"role":"assistant","content":" content"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - - data: {"id":"gen-1761681521-VDbhrTwMjCcpzHXdzNr7","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681522,"choices":[{"index":0,"delta":{"role":"assistant","content":" contains"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - - data: {"id":"gen-1761681521-VDbhrTwMjCcpzHXdzNr7","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681522,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - - data: {"id":"gen-1761681521-VDbhrTwMjCcpzHXdzNr7","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681522,"choices":[{"index":0,"delta":{"role":"assistant","content":" words"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - - data: {"id":"gen-1761681521-VDbhrTwMjCcpzHXdzNr7","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681522,"choices":[{"index":0,"delta":{"role":"assistant","content":" '"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - - data: {"id":"gen-1761681521-VDbhrTwMjCcpzHXdzNr7","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681522,"choices":[{"index":0,"delta":{"role":"assistant","content":"John"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - - data: {"id":"gen-1761681521-VDbhrTwMjCcpzHXdzNr7","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681522,"choices":[{"index":0,"delta":{"role":"assistant","content":" Doe"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - - data: {"id":"gen-1761681521-VDbhrTwMjCcpzHXdzNr7","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681522,"choices":[{"index":0,"delta":{"role":"assistant","content":"'"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - - data: {"id":"gen-1761681521-VDbhrTwMjCcpzHXdzNr7","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681522,"choices":[{"index":0,"delta":{"role":"assistant","content":" multiple"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - - data: {"id":"gen-1761681521-VDbhrTwMjCcpzHXdzNr7","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681522,"choices":[{"index":0,"delta":{"role":"assistant","content":" times"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - - data: {"id":"gen-1761681521-VDbhrTwMjCcpzHXdzNr7","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681522,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - - data: {"id":"gen-1761681521-VDbhrTwMjCcpzHXdzNr7","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681522,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":null} - - data: {"id":"gen-1761681521-VDbhrTwMjCcpzHXdzNr7","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681522,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":11224,"completion_tokens":15,"total_tokens":11239,"cost":0.0067719,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0067344,"upstream_inference_completions_cost":0.0000375},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} - - data: [DONE] - - headers: - Content-Type: - - text/event-stream - status: 200 OK - code: 200 - duration: 1.32072775s diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/glob_tool.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/glob_tool.yaml index 79eba4be5f6de748119f0255cbcb04958f8dd213..d2e1b182aa5f72b6259f83bef875d87d8a6fb2a2 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/glob_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/glob_tool.yaml @@ -24,19 +24,31 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761681523-AIa4Rs8fdHWMJCYVAHh0","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681523,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733816-Itp2AxcvgWIzcqbOvflP","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681523-AIa4Rs8fdHWMJCYVAHh0","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681523,"choices":[{"index":0,"delta":{"role":"assistant","content":"Find"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733816-Itp2AxcvgWIzcqbOvflP","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":"Find"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681523-AIa4Rs8fdHWMJCYVAHh0","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681523,"choices":[{"index":0,"delta":{"role":"assistant","content":" all .go files"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733816-Itp2AxcvgWIzcqbOvflP","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":" all"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681523-AIa4Rs8fdHWMJCYVAHh0","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681523,"choices":[{"index":0,"delta":{"role":"assistant","content":" in current directory using"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733816-Itp2AxcvgWIzcqbOvflP","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":" ."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681523-AIa4Rs8fdHWMJCYVAHh0","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681523,"choices":[{"index":0,"delta":{"role":"assistant","content":" glob"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733816-Itp2AxcvgWIzcqbOvflP","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":"go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681523-AIa4Rs8fdHWMJCYVAHh0","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681523,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761733816-Itp2AxcvgWIzcqbOvflP","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":" files"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681523-AIa4Rs8fdHWMJCYVAHh0","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681523,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":139,"completion_tokens":11,"total_tokens":150,"cost":0.00003405,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00002085,"upstream_inference_completions_cost":0.0000132},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733816-Itp2AxcvgWIzcqbOvflP","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":" in"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733816-Itp2AxcvgWIzcqbOvflP","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":" current"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733816-Itp2AxcvgWIzcqbOvflP","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":" directory"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733816-Itp2AxcvgWIzcqbOvflP","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":" using"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733816-Itp2AxcvgWIzcqbOvflP","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":" glob"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733816-Itp2AxcvgWIzcqbOvflP","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1761733816-Itp2AxcvgWIzcqbOvflP","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":139,"completion_tokens":11,"total_tokens":150,"cost":0.0000227,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000139,"upstream_inference_completions_cost":0.0000088},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -45,15 +57,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.906578584s + duration: 717.71875ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44088 + content_length: 42799 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -69,25 +81,25 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761681523-AecS2eixeEef3tvP5Ub2","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681523,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733816-0GRhrCxFn9tIlcUfKKhC","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761681523-AecS2eixeEef3tvP5Ub2","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681523,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"glob:0","type":"function","function":{"name":"glob"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733816-0GRhrCxFn9tIlcUfKKhC","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"glob:0","type":"function","function":{"name":"glob"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761681523-AecS2eixeEef3tvP5Ub2","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681523,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733816-0GRhrCxFn9tIlcUfKKhC","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761681523-AecS2eixeEef3tvP5Ub2","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681523,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"pattern"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733816-0GRhrCxFn9tIlcUfKKhC","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"pattern"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761681523-AecS2eixeEef3tvP5Ub2","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681523,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733816-0GRhrCxFn9tIlcUfKKhC","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761681523-AecS2eixeEef3tvP5Ub2","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681523,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":" \"*."}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733816-0GRhrCxFn9tIlcUfKKhC","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":" \"*."}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761681523-AecS2eixeEef3tvP5Ub2","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681523,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733816-0GRhrCxFn9tIlcUfKKhC","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761681523-AecS2eixeEef3tvP5Ub2","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681523,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733816-0GRhrCxFn9tIlcUfKKhC","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761681523-AecS2eixeEef3tvP5Ub2","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681523,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733816-0GRhrCxFn9tIlcUfKKhC","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761681523-AecS2eixeEef3tvP5Ub2","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681523,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10878,"completion_tokens":15,"total_tokens":10893,"cost":0.0065643,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0065268,"upstream_inference_completions_cost":0.0000375},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733816-0GRhrCxFn9tIlcUfKKhC","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733816,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10568,"completion_tokens":15,"total_tokens":10583,"cost":0.0063783,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0063408,"upstream_inference_completions_cost":0.0000375},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -96,15 +108,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 2.866439167s + duration: 2.920246125s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44343 + content_length: 43054 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"glob:0\",\"function\":{\"arguments\":\"{\\\"pattern\\\": \\\"*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/glob_tool/main.go\",\"tool_call_id\":\"glob:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"glob:0\",\"function\":{\"arguments\":\"{\\\"pattern\\\": \\\"*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/glob_tool/main.go\",\"tool_call_id\":\"glob:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -120,11 +132,29 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761681526-XbIiMlAaVeeZkBqdFxua","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681526,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733819-ObFfZMhxTHBCJB8yEvaM","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733819,"choices":[{"index":0,"delta":{"role":"assistant","content":"Found"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733819-ObFfZMhxTHBCJB8yEvaM","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733819,"choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733819-ObFfZMhxTHBCJB8yEvaM","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733819,"choices":[{"index":0,"delta":{"role":"assistant","content":"1"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733819-ObFfZMhxTHBCJB8yEvaM","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733819,"choices":[{"index":0,"delta":{"role":"assistant","content":" Go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733819-ObFfZMhxTHBCJB8yEvaM","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733819,"choices":[{"index":0,"delta":{"role":"assistant","content":" file"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733819-ObFfZMhxTHBCJB8yEvaM","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733819,"choices":[{"index":0,"delta":{"role":"assistant","content":":"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733819-ObFfZMhxTHBCJB8yEvaM","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733819,"choices":[{"index":0,"delta":{"role":"assistant","content":" `"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733819-ObFfZMhxTHBCJB8yEvaM","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733819,"choices":[{"index":0,"delta":{"role":"assistant","content":"main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733819-ObFfZMhxTHBCJB8yEvaM","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733819,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733819-ObFfZMhxTHBCJB8yEvaM","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733819,"choices":[{"index":0,"delta":{"role":"assistant","content":"`"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - data: {"id":"gen-1761681526-XbIiMlAaVeeZkBqdFxua","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681526,"choices":[{"index":0,"delta":{"role":"assistant","content":"Found 1 .go file: main.go"},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761733819-ObFfZMhxTHBCJB8yEvaM","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733819,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":null} - data: {"id":"gen-1761681526-XbIiMlAaVeeZkBqdFxua","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681526,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10286,"completion_tokens":9,"total_tokens":10295,"cost":0.005161,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.005143,"upstream_inference_completions_cost":0.000018},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733819-ObFfZMhxTHBCJB8yEvaM","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733819,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10289,"completion_tokens":11,"total_tokens":10300,"cost":0.0062009,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0061734,"upstream_inference_completions_cost":0.0000275},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -133,4 +163,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 825.1335ms + duration: 525.491083ms diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/grep_tool.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/grep_tool.yaml index 6eb5bee6f78081fe9be508c77db3ab13b6caccf1..57bece567890a54874874201d81e03484ffa0d81 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/grep_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/grep_tool.yaml @@ -24,27 +24,17 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761682681-tYJwPHC1Ey3ldJuOlcWM","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682681,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733820-CQHZl42X8s5cISK2alLW","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682681-tYJwPHC1Ey3ldJuOlcWM","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682681,"choices":[{"index":0,"delta":{"role":"assistant","content":"Search"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733820-CQHZl42X8s5cISK2alLW","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":"Search"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682681-tYJwPHC1Ey3ldJuOlcWM","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682681,"choices":[{"index":0,"delta":{"role":"assistant","content":" for"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733820-CQHZl42X8s5cISK2alLW","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":" for package in Go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682681-tYJwPHC1Ey3ldJuOlcWM","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682681,"choices":[{"index":0,"delta":{"role":"assistant","content":" package"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733820-CQHZl42X8s5cISK2alLW","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":" files using grep"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682681-tYJwPHC1Ey3ldJuOlcWM","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682681,"choices":[{"index":0,"delta":{"role":"assistant","content":" in"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733820-CQHZl42X8s5cISK2alLW","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761682681-tYJwPHC1Ey3ldJuOlcWM","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682681,"choices":[{"index":0,"delta":{"role":"assistant","content":" Go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761682681-tYJwPHC1Ey3ldJuOlcWM","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682681,"choices":[{"index":0,"delta":{"role":"assistant","content":" files"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761682681-tYJwPHC1Ey3ldJuOlcWM","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682681,"choices":[{"index":0,"delta":{"role":"assistant","content":" using"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761682681-tYJwPHC1Ey3ldJuOlcWM","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682681,"choices":[{"index":0,"delta":{"role":"assistant","content":" grep"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761682681-tYJwPHC1Ey3ldJuOlcWM","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682681,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - - data: {"id":"gen-1761682681-tYJwPHC1Ey3ldJuOlcWM","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682681,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":140,"completion_tokens":9,"total_tokens":149,"cost":0.0000239,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.000014,"upstream_inference_completions_cost":0.0000099},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733820-CQHZl42X8s5cISK2alLW","provider":"AtlasCloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":144,"completion_tokens":8,"total_tokens":152,"cost":0.0000336,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000216,"upstream_inference_completions_cost":0.000012},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -53,15 +43,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 5.039463417s + duration: 1.170736709s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44086 + content_length: 42797 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -77,11 +67,35 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761682684-Phrnk09TYRInsZdy1x93","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682684,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733820-twlSVCvSqdBOeRePYGWW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733820-twlSVCvSqdBOeRePYGWW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.grep:0","index":0,"type":"function","function":{"name":"grep","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733820-twlSVCvSqdBOeRePYGWW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"pattern"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733820-twlSVCvSqdBOeRePYGWW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733820-twlSVCvSqdBOeRePYGWW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733820-twlSVCvSqdBOeRePYGWW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"package"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682684-Phrnk09TYRInsZdy1x93","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682684,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.grep:0","function":{"arguments":"{\"pattern\": \".*package.*\"}","name":"grep"},"type":"function"}]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761733820-twlSVCvSqdBOeRePYGWW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\","}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682684-Phrnk09TYRInsZdy1x93","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682684,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":11064,"completion_tokens":8,"total_tokens":11072,"cost":0.005548,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.005532,"upstream_inference_completions_cost":0.000016},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733820-twlSVCvSqdBOeRePYGWW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733820-twlSVCvSqdBOeRePYGWW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"include"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733820-twlSVCvSqdBOeRePYGWW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733820-twlSVCvSqdBOeRePYGWW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \"*."}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733820-twlSVCvSqdBOeRePYGWW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733820-twlSVCvSqdBOeRePYGWW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733820-twlSVCvSqdBOeRePYGWW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1761733820-twlSVCvSqdBOeRePYGWW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733820,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":9883,"completion_tokens":23,"total_tokens":9906,"cost":0.00550442,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00543565,"upstream_inference_completions_cost":0.00006877},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -90,15 +104,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 4.797926167s + duration: 899.474542ms - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44420 + content_length: 43150 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.grep:0\",\"function\":{\"arguments\":\"{\\\"pattern\\\": \\\".*package.*\\\"}\",\"name\":\"grep\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"Found 1 matches\\n/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/grep_tool/main.go:\\n Line 1, Char 1: package main\\n\",\"tool_call_id\":\"functions.grep:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.grep:0\",\"function\":{\"arguments\":\"{\\\"pattern\\\": \\\"package\\\", \\\"include\\\": \\\"*.go\\\"}\",\"name\":\"grep\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"Found 1 matches\\n/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/grep_tool/main.go:\\n Line 1, Char 1: package main\\n\",\"tool_call_id\":\"functions.grep:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -114,17 +128,59 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761682686-qyO2sACcbdQFYDp5535M","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682686,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":"Found"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":"1"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":" match"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":" in"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":" /"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":"tmp"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":"/c"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":"rush"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":"-test"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":"/Test"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":"Coder"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":"Agent"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":"/open"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":"router"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":"-k"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":"imi"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":"-k"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":"2"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":"/g"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":"rep"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682686-qyO2sACcbdQFYDp5535M","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682686,"choices":[{"index":0,"delta":{"role":"assistant","content":"Package"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":"_tool"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682686-qyO2sACcbdQFYDp5535M","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682686,"choices":[{"index":0,"delta":{"role":"assistant","content":" declared"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":"/main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682686-qyO2sACcbdQFYDp5535M","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682686,"choices":[{"index":0,"delta":{"role":"assistant","content":" in main.go:1"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682686-qyO2sACcbdQFYDp5535M","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682686,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761682686-qyO2sACcbdQFYDp5535M","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682686,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10521,"completion_tokens":8,"total_tokens":10529,"cost":0.010545,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.010521,"upstream_inference_completions_cost":0.000024},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733821-QZcLcI99VQGVVwMe8MFB","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733821,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":9958,"completion_tokens":25,"total_tokens":9983,"cost":0.00393112,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00388362,"upstream_inference_completions_cost":0.0000475},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -133,4 +189,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.7368025s + duration: 1.443109291s diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/ls_tool.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/ls_tool.yaml index 020fed9e62e4384d6bf65f9c4143c8d52b0e43ff..35e08270a5dab0f84402e73db28a5f150e2315b3 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/ls_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/ls_tool.yaml @@ -6,9 +6,9 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 758 + content_length: 42791 host: "" - body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nuse ls to list the files in the current directory\n \n\n","role":"user"}],"model":"qwen/qwen3-next-80b-a3b-instruct","max_tokens":40,"stream_options":{"include_usage":true},"usage":{"include":true},"stream":true}' + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -24,25 +24,53 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761682070-KoRJgCqOyhjuH2xKrf7P","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.ls:0","index":0,"type":"function","function":{"name":"ls","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \"/"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-KoRJgCqOyhjuH2xKrf7P","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":"List"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-KoRJgCqOyhjuH2xKrf7P","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":" files"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-KoRJgCqOyhjuH2xKrf7P","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":" in"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-KoRJgCqOyhjuH2xKrf7P","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":" current"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-KoRJgCqOyhjuH2xKrf7P","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":" directory"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-KoRJgCqOyhjuH2xKrf7P","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":" using"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-KoRJgCqOyhjuH2xKrf7P","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":" ls"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"ls"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-KoRJgCqOyhjuH2xKrf7P","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_tool"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-KoRJgCqOyhjuH2xKrf7P","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":137,"completion_tokens":8,"total_tokens":145,"cost":0.0000225,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000137,"upstream_inference_completions_cost":0.0000088},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1761733823-8xEXviBuu8TTGf5bO3wr","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":9880,"completion_tokens":32,"total_tokens":9912,"cost":0.006008,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.005928,"upstream_inference_completions_cost":0.00008},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -51,15 +79,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.775485334s + duration: 1.517049166s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44080 + content_length: 758 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nuse ls to list the files in the current directory\n \n\n","role":"user"}],"model":"qwen/qwen3-next-80b-a3b-instruct","max_tokens":40,"stream_options":{"include_usage":true},"usage":{"include":true},"stream":true}' headers: Accept: - application/json @@ -75,55 +103,41 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"ls:0","type":"function","function":{"name":"ls"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733823-006iS405Flssli5jaASa","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733823-006iS405Flssli5jaASa","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":" \"/"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733823-006iS405Flssli5jaASa","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":"List"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733823-006iS405Flssli5jaASa","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":" seems"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733823-006iS405Flssli5jaASa","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":" you’ve"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733823-006iS405Flssli5jaASa","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":" sent"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733823-006iS405Flssli5jaASa","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":" a command"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733823-006iS405Flssli5jaASa","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":" but"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733823-006iS405Flssli5jaASa","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":" not"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733823-006iS405Flssli5jaASa","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":" a message to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733823-006iS405Flssli5jaASa","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":" summarize."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733823-006iS405Flssli5jaASa","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":" Please provide the content"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733823-006iS405Flssli5jaASa","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":" you’d"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733823-006iS405Flssli5jaASa","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":" like summarized into"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733823-006iS405Flssli5jaASa","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":" a short"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733823-006iS405Flssli5jaASa","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":" title."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"/"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733823-006iS405Flssli5jaASa","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"ls"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"_tool"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682070-GwPXnieXs47JlEVGkCZO","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682070,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10876,"completion_tokens":31,"total_tokens":10907,"cost":0.0066031,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0065256,"upstream_inference_completions_cost":0.0000775},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733823-006iS405Flssli5jaASa","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733823,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":137,"completion_tokens":28,"total_tokens":165,"cost":0.00004998,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00001918,"upstream_inference_completions_cost":0.0000308},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -132,15 +146,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 4.437106583s + duration: 555.00025ms - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44401 + content_length: 43132 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"ls:0\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/ls_tool\\\"}\",\"name\":\"ls\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/ls_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"ls:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.ls:0\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/ls_tool\\\"}\",\"name\":\"ls\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/ls_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"functions.ls:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -156,27 +170,21 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761682075-cWaJWpyNzDMyTMd11yzu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682076,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - - data: {"id":"gen-1761682075-cWaJWpyNzDMyTMd11yzu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682076,"choices":[{"index":0,"delta":{"role":"assistant","content":"Two"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - - data: {"id":"gen-1761682075-cWaJWpyNzDMyTMd11yzu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682076,"choices":[{"index":0,"delta":{"role":"assistant","content":" files"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - - data: {"id":"gen-1761682075-cWaJWpyNzDMyTMd11yzu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682076,"choices":[{"index":0,"delta":{"role":"assistant","content":":"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733826-dXno8gpG1Oevi7T0l3Mo","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733826,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682075-cWaJWpyNzDMyTMd11yzu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682076,"choices":[{"index":0,"delta":{"role":"assistant","content":" go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733826-dXno8gpG1Oevi7T0l3Mo","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733826,"choices":[{"index":0,"delta":{"role":"assistant","content":"go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682075-cWaJWpyNzDMyTMd11yzu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682076,"choices":[{"index":0,"delta":{"role":"assistant","content":".mod"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733826-dXno8gpG1Oevi7T0l3Mo","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733826,"choices":[{"index":0,"delta":{"role":"assistant","content":".mod"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682075-cWaJWpyNzDMyTMd11yzu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682076,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733826-dXno8gpG1Oevi7T0l3Mo","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733826,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682075-cWaJWpyNzDMyTMd11yzu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682076,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733826-dXno8gpG1Oevi7T0l3Mo","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733826,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682075-cWaJWpyNzDMyTMd11yzu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682076,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733826-dXno8gpG1Oevi7T0l3Mo","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733826,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682075-cWaJWpyNzDMyTMd11yzu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682076,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733826-dXno8gpG1Oevi7T0l3Mo","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733826,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682075-cWaJWpyNzDMyTMd11yzu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682076,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10302,"completion_tokens":8,"total_tokens":10310,"cost":0.0041368,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0041208,"upstream_inference_completions_cost":0.000016},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733826-dXno8gpG1Oevi7T0l3Mo","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733826,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10643,"completion_tokens":6,"total_tokens":10649,"cost":0.0016776,"is_byok":false,"prompt_tokens_details":{"cached_tokens":10496,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0016626,"upstream_inference_completions_cost":0.000015},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -185,4 +193,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 4.866915875s + duration: 2.145133167s diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/multiedit_tool.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/multiedit_tool.yaml index df4e40885d0a00f3a6abc4c74f184bacf282fd1f..29c84ef60a7390d895d15ee757a4a222ea368ed1 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/multiedit_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/multiedit_tool.yaml @@ -24,21 +24,21 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761682080-aFNbmWGKBHHPKcET0Z39","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-6t3xDpaxxRgcurwc8tki","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682080-aFNbmWGKBHHPKcET0Z39","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":"Use"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-6t3xDpaxxRgcurwc8tki","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":"Use"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682080-aFNbmWGKBHHPKcET0Z39","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" multiedit to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-6t3xDpaxxRgcurwc8tki","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" multiedit to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682080-aFNbmWGKBHHPKcET0Z39","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" update greeting"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-6t3xDpaxxRgcurwc8tki","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" update greeting"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682080-aFNbmWGKBHHPKcET0Z39","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" and add comment in"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-6t3xDpaxxRgcurwc8tki","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" and add comment in"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682080-aFNbmWGKBHHPKcET0Z39","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" main.go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-6t3xDpaxxRgcurwc8tki","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" main.go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682080-aFNbmWGKBHHPKcET0Z39","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761733828-6t3xDpaxxRgcurwc8tki","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761682080-aFNbmWGKBHHPKcET0Z39","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":160,"completion_tokens":14,"total_tokens":174,"cost":0.0000408,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.000024,"upstream_inference_completions_cost":0.0000168},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733828-6t3xDpaxxRgcurwc8tki","provider":"Google","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":160,"completion_tokens":14,"total_tokens":174,"cost":0.0000408,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.000024,"upstream_inference_completions_cost":0.0000168},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -47,15 +47,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.107639958s + duration: 419.65225ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44166 + content_length: 42877 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -71,107 +71,119 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":"I"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":"I'll"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" need"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" help"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" you"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" first"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" make"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" check"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" those"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" changes"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" current"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" content"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" of"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" using"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" mult"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":"ied"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" see"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":"it"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" exact"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" Let"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" formatting"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" me"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" first"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" context"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" read"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" before"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" making"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" file"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":" edits"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" see"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" its"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.view:0","index":0,"type":"function","function":{"name":"view","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" current"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"file"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" content"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":" structure"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \"/"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"view:0","type":"function","function":{"name":"view","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"{\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"file"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_path"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \"/"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"tmp"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/c"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"rush"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-test"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/Test"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Coder"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Agent"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/mult"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/open"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"ied"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"router"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"it"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-k"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_tool"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"imi"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/main"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-k"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"2"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/mult"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"ied"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682081-4dSCb7aCoJ1SfxUpAaQ3","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682081,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10174,"completion_tokens":58,"total_tokens":10232,"cost":0.00576912,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0055957,"upstream_inference_completions_cost":0.00017342},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"it"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_tool"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/main"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":".go"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\"}"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733828-bRhWfDjULsovVTHPLqhR","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733828,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10590,"completion_tokens":62,"total_tokens":10652,"cost":0.0017858,"is_byok":false,"prompt_tokens_details":{"cached_tokens":10496,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0016308,"upstream_inference_completions_cost":0.000155},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -180,15 +192,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 2.06376575s + duration: 1.999484125s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44726 + content_length: 43429 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"content\":\"I need to first check the current content of main.go to see the exact formatting and context before making the edits.\",\"tool_calls\":[{\"id\":\"functions.view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"functions.view:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"content\":\"I'll help you make those changes to main.go using multiedit. Let me first read the file to see its current content and structure.\",\"tool_calls\":[{\"id\":\"view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"view:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -204,193 +216,295 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":"Now"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":" I'll"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":" use"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":" mult"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":"ied"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":"it"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":" make"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":" both"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":" changes"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":" -"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":" adding"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":" comment"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":" above"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":" fmt"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":".Println"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":" changing"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":" greeting"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":" message"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":":"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"multiedit:1","type":"function","function":{"name":"multiedit","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"{\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"file"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_path"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \"/"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"tmp"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/c"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"rush"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-test"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/Test"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Coder"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Agent"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/open"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"router"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":"Now"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-k"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" I"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"imi"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" can"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-k"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" use"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"2"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" mult"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/mult"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":"ied"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"ied"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":"it"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"it"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_tool"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" make"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/main"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" both"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":".go"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" changes"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\","},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" -"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" adding"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"ed"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"its"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" comment"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" above"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" [\n"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" "},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" fmt"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" {\n"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":".Println"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" "},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" line"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"old"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" changing"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_string"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" greeting"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":" text"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"func"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":":"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" main"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.multiedit:1","index":0,"type":"function","function":{"name":"multiedit","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"()"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"file"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" {\\"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"n"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\\t"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \"/"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"fmt"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":".Println"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"(\\\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Hello"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":","},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" World"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"!\\"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\")"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\",\n"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" "},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"new"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_string"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/mult"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"ied"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"func"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"it"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" main"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_tool"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"()"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/main"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" {\\"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"n"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\","}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\\t"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"//"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"ed"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" G"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"its"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"reeting"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\\n"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" [{\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\\t"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"old"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"fmt"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_string"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":".Println"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"(\\\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \"\\"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Hello"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tf"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":","},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"mt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" World"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".Println"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"!\\"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"(\\\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\")"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Hello"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\"\n"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":","}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" "},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" World"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" },\n"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"!\\"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" "},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\")"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" {\n"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\","}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" "},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"new"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"old"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_string"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_string"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \"\\"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \"\\"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"t"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"tf"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"//"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"mt"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" G"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":".Println"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"reeting"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"(\\\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\\n"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Hello"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\\t"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":","},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"fmt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" World"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".Println"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"!\\"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"(\\\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\")"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Hello"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\",\n"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":","}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" "},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" Crush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"!\\"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"new"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\")"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_string"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"]}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \"\\"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"tf"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682084-G73EMT7J1QaccZmnYJs3","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682084,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10299,"completion_tokens":103,"total_tokens":10402,"cost":0.0064369,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0061794,"upstream_inference_completions_cost":0.0002575},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"mt"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":".Println"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"(\\\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Hello"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":","},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" Crush"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"!\\"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\")"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\"\n"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" "},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" }\n"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"]}"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733834-1RlJCvOO0WxdVf8rwbin","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733834,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10720,"completion_tokens":152,"total_tokens":10872,"cost":0.0020888,"is_byok":false,"prompt_tokens_details":{"cached_tokens":10496,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0017088,"upstream_inference_completions_cost":0.00038},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -399,15 +513,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.918512792s + duration: 2.805268084s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45426 + content_length: 44293 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"content\":\"I need to first check the current content of main.go to see the exact formatting and context before making the edits.\",\"tool_calls\":[{\"id\":\"functions.view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"functions.view:0\",\"role\":\"tool\"},{\"content\":\"Now I can use multiedit to make both changes - adding the comment above the fmt.Println line and changing the greeting text:\",\"tool_calls\":[{\"id\":\"functions.multiedit:1\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\\", \\\"edits\\\": [{\\\"old_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\", \\\"new_string\\\": \\\"\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\"}]}\",\"name\":\"multiedit\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\nApplied 1 edits to file: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\n\\n\",\"tool_call_id\":\"functions.multiedit:1\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"content\":\"I'll help you make those changes to main.go using multiedit. Let me first read the file to see its current content and structure.\",\"tool_calls\":[{\"id\":\"view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"view:0\",\"role\":\"tool\"},{\"content\":\"Now I'll use multiedit to make both changes - adding the comment above fmt.Println and changing the greeting message:\",\"tool_calls\":[{\"id\":\"multiedit:1\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\\", \\\"edits\\\": [\\n {\\n \\\"old_string\\\": \\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\",\\n \\\"new_string\\\": \\\"func main() {\\\\n\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\"\\n },\\n {\\n \\\"old_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\",\\n \\\"new_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\"\\n }\\n]}\",\"name\":\"multiedit\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\nApplied 2 edits to file: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\n\\n\",\"tool_call_id\":\"multiedit:1\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -423,61 +537,87 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":"Now"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":" let"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":" me"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":" verify"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":" changes"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":" by"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":" viewing"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.view:2","index":0,"type":"function","function":{"name":"view","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":" updated"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"file"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":" file"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":":"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"view:2","type":"function","function":{"name":"view","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \"/"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"{\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"file"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_path"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \"/"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"tmp"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/c"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"rush"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-test"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/Test"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Coder"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Agent"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/open"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"router"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/mult"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-k"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"ied"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"imi"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"it"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-k"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_tool"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"2"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/main"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/mult"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"ied"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"it"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_tool"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682087-xC4manDhdbDDlz4JnuwW","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682087,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10453,"completion_tokens":35,"total_tokens":10488,"cost":0.0058538,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00574915,"upstream_inference_completions_cost":0.00010465},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/main"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":".go"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\"}"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733848-ucO7rp6VrNbkLayHly3g","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733848,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10924,"completion_tokens":46,"total_tokens":10970,"cost":0.0019462,"is_byok":false,"prompt_tokens_details":{"cached_tokens":10496,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0018312,"upstream_inference_completions_cost":0.000115},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -486,15 +626,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.590506084s + duration: 2.335020875s - id: 4 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45878 + content_length: 44796 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"content\":\"I need to first check the current content of main.go to see the exact formatting and context before making the edits.\",\"tool_calls\":[{\"id\":\"functions.view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"functions.view:0\",\"role\":\"tool\"},{\"content\":\"Now I can use multiedit to make both changes - adding the comment above the fmt.Println line and changing the greeting text:\",\"tool_calls\":[{\"id\":\"functions.multiedit:1\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\\", \\\"edits\\\": [{\\\"old_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\", \\\"new_string\\\": \\\"\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\"}]}\",\"name\":\"multiedit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nApplied 1 edits to file: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\n\\n\",\"tool_call_id\":\"functions.multiedit:1\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"functions.view:2\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\t// Greeting\\n 7|\\tfmt.Println(\\\"Hello, Crush!\\\")\\n 8|}\\n\\n\",\"tool_call_id\":\"functions.view:2\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"content\":\"I'll help you make those changes to main.go using multiedit. Let me first read the file to see its current content and structure.\",\"tool_calls\":[{\"id\":\"view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"view:0\",\"role\":\"tool\"},{\"content\":\"Now I'll use multiedit to make both changes - adding the comment above fmt.Println and changing the greeting message:\",\"tool_calls\":[{\"id\":\"multiedit:1\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\\", \\\"edits\\\": [\\n {\\n \\\"old_string\\\": \\\"func main() {\\\\n\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\",\\n \\\"new_string\\\": \\\"func main() {\\\\n\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\"\\n },\\n {\\n \\\"old_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\",\\n \\\"new_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\"\\n }\\n]}\",\"name\":\"multiedit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nApplied 2 edits to file: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\n\\n\",\"tool_call_id\":\"multiedit:1\",\"role\":\"tool\"},{\"content\":\"Now let me verify the changes by viewing the updated file:\",\"tool_calls\":[{\"id\":\"view:2\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\t// Greeting\\n 7|\\tfmt.Println(\\\"Hello, Crush!\\\")\\n 8|}\\n\\n\",\"tool_call_id\":\"view:2\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -510,93 +650,129 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":"Done"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":"Done"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" The"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" changes"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" have"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" been"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" successfully"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" applied"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":":\n\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":"1"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" Added"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" comment"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" `"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":"//"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" G"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":"reeting"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":"`"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" The"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" above"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" changes"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" have"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" fmt"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" been"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":".Println"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" applied"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" line"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" successfully"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" -"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":"2"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" greeting"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" Changed"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" has"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" '"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" been"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" changed"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" from"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" World"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":"!'"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" '"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" World"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":"!\""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" Crush"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":"!'"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" in"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" Crush"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" print"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":"!\""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" statement"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":"\n\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" a"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":"The"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" comment"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" file"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" \"//"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" now"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" G"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" shows"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":"reeting"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":"\""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" greeting"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" has"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" message"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" been"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" with"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" added"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" above"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" comment"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" above"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" fmt"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" it"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":".Println"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" as"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":" line"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":" requested"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682091-NEgVAwwhmtoKroorZgEw","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682091,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10963,"completion_tokens":43,"total_tokens":11006,"cost":0.0066853,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0065778,"upstream_inference_completions_cost":0.0001075},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733852-Pa85pWFc8neBgR78ypB1","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733852,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":11047,"completion_tokens":60,"total_tokens":11107,"cost":0.0019398,"is_byok":false,"prompt_tokens_details":{"cached_tokens":10752,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0017898,"upstream_inference_completions_cost":0.00015},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -605,4 +781,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 5.399622958s + duration: 2.241229709s diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls.yaml index 8c20147d293c09d46beaef3c5d4fecd544dea65f..8118800d94fac603091728a487dd9a7b60556cf4 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls.yaml @@ -6,9 +6,9 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 843 + content_length: 42888 host: "" - body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nuse glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\n \n\n","role":"user"}],"model":"qwen/qwen3-next-80b-a3b-instruct","max_tokens":40,"stream_options":{"include_usage":true},"usage":{"include":true},"stream":true}' + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -24,39 +24,39 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761682116-TteZV0O6hO0XOIaBiXId","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-oD9BxYPSq22fgWremUm2","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682116-TteZV0O6hO0XOIaBiXId","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":"Run"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-oD9BxYPSq22fgWremUm2","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"glob:0","type":"function","function":{"name":"glob","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682116-TteZV0O6hO0XOIaBiXId","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":" glob"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-oD9BxYPSq22fgWremUm2","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"{\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682116-TteZV0O6hO0XOIaBiXId","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-oD9BxYPSq22fgWremUm2","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"pattern"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682116-TteZV0O6hO0XOIaBiXId","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":" ls"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-oD9BxYPSq22fgWremUm2","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682116-TteZV0O6hO0XOIaBiXId","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":" in"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-oD9BxYPSq22fgWremUm2","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \"**"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682116-TteZV0O6hO0XOIaBiXId","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":" parallel"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-oD9BxYPSq22fgWremUm2","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/*."},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682116-TteZV0O6hO0XOIaBiXId","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-oD9BxYPSq22fgWremUm2","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"go"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682116-TteZV0O6hO0XOIaBiXId","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":" find"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-oD9BxYPSq22fgWremUm2","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\"}"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682116-TteZV0O6hO0XOIaBiXId","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":" ."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-oD9BxYPSq22fgWremUm2","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"id":"ls:1","type":"function","function":{"name":"ls","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682116-TteZV0O6hO0XOIaBiXId","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":"go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-oD9BxYPSq22fgWremUm2","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"function":{"arguments":"{\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682116-TteZV0O6hO0XOIaBiXId","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":" files"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-oD9BxYPSq22fgWremUm2","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"function":{"arguments":"path"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682116-TteZV0O6hO0XOIaBiXId","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-oD9BxYPSq22fgWremUm2","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682116-TteZV0O6hO0XOIaBiXId","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":" list"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-oD9BxYPSq22fgWremUm2","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"function":{"arguments":" \".\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682116-TteZV0O6hO0XOIaBiXId","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":" directory"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-oD9BxYPSq22fgWremUm2","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"function":{"arguments":"}"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682116-TteZV0O6hO0XOIaBiXId","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761733875-oD9BxYPSq22fgWremUm2","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682116-TteZV0O6hO0XOIaBiXId","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":156,"completion_tokens":15,"total_tokens":171,"cost":0.0000321,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000156,"upstream_inference_completions_cost":0.0000165},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733875-oD9BxYPSq22fgWremUm2","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10586,"completion_tokens":29,"total_tokens":10615,"cost":0.0017009,"is_byok":false,"prompt_tokens_details":{"cached_tokens":10496,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0016284,"upstream_inference_completions_cost":0.0000725},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -65,15 +65,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 652.183625ms + duration: 2.954814667s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44177 + content_length: 843 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nuse glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\n \n\n","role":"user"}],"model":"qwen/qwen3-next-80b-a3b-instruct","max_tokens":40,"stream_options":{"include_usage":true},"usage":{"include":true},"stream":true}' headers: Accept: - application/json @@ -89,29 +89,29 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761682116-nfRhKuXLcRCWbb7d42cl","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-ZzbnGrtSByDwaBuSyD1C","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682116-nfRhKuXLcRCWbb7d42cl","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.glob:0","index":0,"type":"function","function":{"name":"glob","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-ZzbnGrtSByDwaBuSyD1C","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":"Find"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682116-nfRhKuXLcRCWbb7d42cl","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"pattern"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-ZzbnGrtSByDwaBuSyD1C","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":" ."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682116-nfRhKuXLcRCWbb7d42cl","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-ZzbnGrtSByDwaBuSyD1C","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":"go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682116-nfRhKuXLcRCWbb7d42cl","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \"**"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-ZzbnGrtSByDwaBuSyD1C","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":" files"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682116-nfRhKuXLcRCWbb7d42cl","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/*."}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-ZzbnGrtSByDwaBuSyD1C","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682116-nfRhKuXLcRCWbb7d42cl","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-ZzbnGrtSByDwaBuSyD1C","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":" list"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682116-nfRhKuXLcRCWbb7d42cl","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-ZzbnGrtSByDwaBuSyD1C","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":" directory"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682116-nfRhKuXLcRCWbb7d42cl","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.ls:1","index":1,"type":"function","function":{"name":"ls","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-ZzbnGrtSByDwaBuSyD1C","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":" in"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682116-nfRhKuXLcRCWbb7d42cl","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":1,"type":"function","function":{"name":null,"arguments":"{}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733875-ZzbnGrtSByDwaBuSyD1C","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":" parallel"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682116-nfRhKuXLcRCWbb7d42cl","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761733875-ZzbnGrtSByDwaBuSyD1C","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761682116-nfRhKuXLcRCWbb7d42cl","provider":"AtlasCloud","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682116,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10170,"completion_tokens":26,"total_tokens":10196,"cost":0.006167,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.006102,"upstream_inference_completions_cost":0.000065},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733875-ZzbnGrtSByDwaBuSyD1C","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733875,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":156,"completion_tokens":10,"total_tokens":166,"cost":0.0000236,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000156,"upstream_inference_completions_cost":0.000008},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -120,15 +120,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.241017459s + duration: 4.713146s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44711 + content_length: 43397 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.glob:0\",\"function\":{\"arguments\":\"{\\\"pattern\\\": \\\"**/*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"},{\"id\":\"functions.ls:1\",\"function\":{\"arguments\":\"{}\",\"name\":\"ls\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls/main.go\",\"tool_call_id\":\"functions.glob:0\",\"role\":\"tool\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"functions.ls:1\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"glob:0\",\"function\":{\"arguments\":\"{\\\"pattern\\\": \\\"**/*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"},{\"id\":\"ls:1\",\"function\":{\"arguments\":\"{\\\"path\\\": \\\".\\\"}\",\"name\":\"ls\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls/main.go\",\"tool_call_id\":\"glob:0\",\"role\":\"tool\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/parallel_tool_calls/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"ls:1\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -144,53 +144,91 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"Found"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"1"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":" Go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":" file"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":":"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":" `/"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"tmp"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"/c"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"rush"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"-test"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"/Test"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"Coder"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"Agent"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"/open"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"router"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"-k"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"imi"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"-k"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":"1"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"2"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":" ."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"/"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":"go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"parallel"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":" file"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"_tool"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":" found"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"_calls"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":":"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"/main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":" `"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":"main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"`\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"Current"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":"`\n\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":" directory"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":"Current"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":" contains"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":" directory"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":":"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":" contents"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":" `"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":":\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":"-"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":".mod"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":" go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"`"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":".mod"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":" `"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":"-"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":"`"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682118-Fmmv9wPByLBYF1luGtnN","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682118,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10350,"completion_tokens":21,"total_tokens":10371,"cost":0.004182,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00414,"upstream_inference_completions_cost":0.000042},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733880-7Bvg9lTexUCWmMcYrU6R","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733880,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10693,"completion_tokens":41,"total_tokens":10734,"cost":0.0017951,"is_byok":false,"prompt_tokens_details":{"cached_tokens":10496,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0016926,"upstream_inference_completions_cost":0.0001025},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -199,4 +237,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 4.131646s + duration: 3.380920334s diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/read_a_file.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/read_a_file.yaml index 69eca7b87345395df2a10d760e828eeff5d1ad29..f1c05c673a71ed7be88dd880bd928e888f63e8fd 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/read_a_file.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/read_a_file.yaml @@ -6,9 +6,54 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44050 + content_length: 724 + host: "" + body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nRead the go mod\n \n\n","role":"user"}],"model":"qwen/qwen3-next-80b-a3b-instruct","max_tokens":40,"stream_options":{"include_usage":true},"usage":{"include":true},"stream":true}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - OpenAI/Go 2.7.1 + url: https://openrouter.ai/api/v1/chat/completions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + content_length: -1 + body: |+ + data: {"id":"gen-1761733779-sEc7tEApUgYMUp7lbCac","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733779-sEc7tEApUgYMUp7lbCac","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":"Read"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733779-sEc7tEApUgYMUp7lbCac","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733779-sEc7tEApUgYMUp7lbCac","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":" go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733779-sEc7tEApUgYMUp7lbCac","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":" mod"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733779-sEc7tEApUgYMUp7lbCac","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1761733779-sEc7tEApUgYMUp7lbCac","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":131,"completion_tokens":5,"total_tokens":136,"cost":0.0000186,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000131,"upstream_inference_completions_cost":0.0000055},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + + data: [DONE] + + headers: + Content-Type: + - text/event-stream + status: 200 OK + code: 200 + duration: 1.006641375s +- id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 42761 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"Read the go mod\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"Read the go mod\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -24,59 +69,67 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"view","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"{\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"file"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"_path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.view:0","index":0,"type":"function","function":{"name":"view","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"\":\"/"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"file"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \"/"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"/read"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"_a"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"_file"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"/go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/read"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":".mod"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_a"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_file"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"id":"functions.ls:1","type":"function","function":{"name":"ls","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".mod"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"id":null,"type":"function","function":{"arguments":"{"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":1,"id":null,"type":"function","function":{"arguments":"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681487-1HpKZV4cnMpMZ9g6oAkB","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10144,"completion_tokens":34,"total_tokens":10178,"cost":0.00568086,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0055792,"upstream_inference_completions_cost":0.00010166},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733779-aRHVEB2A3SKaMsUrxYDu","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733779,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":9944,"completion_tokens":41,"total_tokens":9985,"cost":0.0040596,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0039776,"upstream_inference_completions_cost":0.000082},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -85,15 +138,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.137487166s -- id: 1 + duration: 4.106994583s +- id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 724 + content_length: 43353 host: "" - body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nRead the go mod\n \n\n","role":"user"}],"model":"qwen/qwen3-next-80b-a3b-instruct","max_tokens":40,"stream_options":{"include_usage":true},"usage":{"include":true},"stream":true}' + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/read_a_file/go.mod\\\"}\",\"name\":\"view\"},\"type\":\"function\"},{\"id\":\"functions.ls:1\",\"function\":{\"arguments\":\"{}\",\"name\":\"ls\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"functions.view:0\",\"role\":\"tool\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/read_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"functions.ls:1\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -109,15 +162,55 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761681487-kAAiFyRGJL4g0NBX3ULS","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"view","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"{\"file"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"_path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"\":\"/"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - data: {"id":"gen-1761681487-kAAiFyRGJL4g0NBX3ULS","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":"Read"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - data: {"id":"gen-1761681487-kAAiFyRGJL4g0NBX3ULS","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":" the go mod"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - data: {"id":"gen-1761681487-kAAiFyRGJL4g0NBX3ULS","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} - data: {"id":"gen-1761681487-kAAiFyRGJL4g0NBX3ULS","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681487,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":131,"completion_tokens":5,"total_tokens":136,"cost":0.00002715,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00001965,"upstream_inference_completions_cost":0.0000075},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"/read"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"_a"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"_file"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"/main"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":".go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:2","type":"function","function":{"name":"","arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":null} + + data: {"id":"gen-1761733786-m1OPYGzGsvwYjwswjp4s","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733786,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10362,"completion_tokens":33,"total_tokens":10395,"cost":0.0062997,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0062172,"upstream_inference_completions_cost":0.0000825},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -126,15 +219,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 2.951124625s -- id: 2 + duration: 892.2075ms +- id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44405 + content_length: 43779 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/read_a_file/go.mod\\\"}\",\"name\":\"view\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"functions.view:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/read_a_file/go.mod\\\"}\",\"name\":\"view\"},\"type\":\"function\"},{\"id\":\"functions.ls:1\",\"function\":{\"arguments\":\"{}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"functions.view:0\",\"role\":\"tool\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/read_a_file/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"functions.ls:1\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"functions.view:2\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/read_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"functions.view:2\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -150,21 +243,105 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761681490-oTOd1t7GZDt2w6hRySJ5","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681490,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"File"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":" is"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":" `/"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"tmp"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"/c"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"rush"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"-test"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"/Test"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"Coder"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"Agent"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"/open"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"router"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"-k"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"imi"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"-k"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"2"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"/read"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"_a"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"_file"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"/go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":".mod"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"`,"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":" line"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"1"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":" shows"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":" it's"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":" a"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":" Go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":" module"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":" with"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":" the"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":" name"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":" `"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"example"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":".com"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"/test"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"project"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"`"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":" Go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":" version"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761681490-oTOd1t7GZDt2w6hRySJ5","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681490,"choices":[{"index":0,"delta":{"role":"assistant","content":"<"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761681490-oTOd1t7GZDt2w6hRySJ5","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681490,"choices":[{"index":0,"delta":{"role":"assistant","content":"go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"1"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761681490-oTOd1t7GZDt2w6hRySJ5","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681490,"choices":[{"index":0,"delta":{"role":"assistant","content":".mod>\nmodule example.com/test"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761681490-oTOd1t7GZDt2w6hRySJ5","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681490,"choices":[{"index":0,"delta":{"role":"assistant","content":"project\n\ngo 1."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"23"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761681490-oTOd1t7GZDt2w6hRySJ5","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681490,"choices":[{"index":0,"delta":{"role":"assistant","content":"23\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761681490-oTOd1t7GZDt2w6hRySJ5","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681490,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761681490-oTOd1t7GZDt2w6hRySJ5","provider":"Together","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681490,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10520,"completion_tokens":21,"total_tokens":10541,"cost":0.010583,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.01052,"upstream_inference_completions_cost":0.000063},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733787-dVAO4WPlC9lP35HNsmbg","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733787,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10788,"completion_tokens":48,"total_tokens":10836,"cost":0.0065928,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0064728,"upstream_inference_completions_cost":0.00012},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -173,4 +350,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 2.956648541s + duration: 5.489133458s diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/simple_test.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/simple_test.yaml index 52fd4c802edcb91655c4db0c32f79a66c7f808a7..b0900af2a9a7936084927865a11ee044e8f0a0ab 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/simple_test.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/simple_test.yaml @@ -24,13 +24,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761681484-LmlRifrM7XnC8PwbmPQg","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681484,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733771-iUUmpKrD6ph4346Kptnp","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733771,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681484-LmlRifrM7XnC8PwbmPQg","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681484,"choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733771-iUUmpKrD6ph4346Kptnp","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733771,"choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681484-LmlRifrM7XnC8PwbmPQg","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681484,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761733771-iUUmpKrD6ph4346Kptnp","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733771,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761681484-LmlRifrM7XnC8PwbmPQg","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681484,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":128,"completion_tokens":2,"total_tokens":130,"cost":0.000015,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000128,"upstream_inference_completions_cost":0.0000022},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733771-iUUmpKrD6ph4346Kptnp","provider":"GMICloud","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733771,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":128,"completion_tokens":2,"total_tokens":130,"cost":0.0000222,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000192,"upstream_inference_completions_cost":0.000003},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -39,15 +39,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 7.559907625s + duration: 1.234817583s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44040 + content_length: 42751 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/simple_test\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"Hello\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/simple_test\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"Hello\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -63,13 +63,15 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761681481-d5cI4E3pwRHy72BhHgKy","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681482,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733771-VAJMK1i5ONdLyn1C5Mbb","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733771,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681481-d5cI4E3pwRHy72BhHgKy","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681482,"choices":[{"index":0,"delta":{"role":"assistant","content":"Hi"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733771-VAJMK1i5ONdLyn1C5Mbb","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733771,"choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681481-d5cI4E3pwRHy72BhHgKy","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681482,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733771-VAJMK1i5ONdLyn1C5Mbb","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733771,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} - data: {"id":"gen-1761681481-d5cI4E3pwRHy72BhHgKy","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681482,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10866,"completion_tokens":2,"total_tokens":10868,"cost":0.0065246,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0065196,"upstream_inference_completions_cost":0.000005},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733771-VAJMK1i5ONdLyn1C5Mbb","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733771,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":""} + + data: {"id":"gen-1761733771-VAJMK1i5ONdLyn1C5Mbb","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733771,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":9940,"completion_tokens":2,"total_tokens":9942,"cost":0.00398,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.003976,"upstream_inference_completions_cost":0.000004},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -78,4 +80,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 9.079050666s + duration: 8.038143541s diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/sourcegraph_tool.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/sourcegraph_tool.yaml index 6ce1e5f03a6b9d1b1f9cb4c3a1472c1421390d8e..eedb55a206340b0fb9b2bf316536f0ec4f2de249 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/sourcegraph_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/sourcegraph_tool.yaml @@ -24,21 +24,23 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761682095-LEJwmEsBmTSWiw4qEO65","provider":"Hyperbolic","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733858-zXu6rsGdHU6vwoDH9ubX","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682095-LEJwmEsBmTSWiw4qEO65","provider":"Hyperbolic","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":"Search"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733858-zXu6rsGdHU6vwoDH9ubX","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682095-LEJwmEsBmTSWiw4qEO65","provider":"Hyperbolic","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":" for func"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733858-zXu6rsGdHU6vwoDH9ubX","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":"Search"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682095-LEJwmEsBmTSWiw4qEO65","provider":"Hyperbolic","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":" main in Go repositories"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733858-zXu6rsGdHU6vwoDH9ubX","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":" for func"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682095-LEJwmEsBmTSWiw4qEO65","provider":"Hyperbolic","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":" using Source"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733858-zXu6rsGdHU6vwoDH9ubX","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":" main in Go repositories"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682095-LEJwmEsBmTSWiw4qEO65","provider":"Hyperbolic","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":"graph"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733858-zXu6rsGdHU6vwoDH9ubX","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":" using Source"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682095-LEJwmEsBmTSWiw4qEO65","provider":"Hyperbolic","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761733858-zXu6rsGdHU6vwoDH9ubX","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":"graph"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682095-LEJwmEsBmTSWiw4qEO65","provider":"Hyperbolic","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":140,"completion_tokens":11,"total_tokens":151,"cost":0.0000453,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.000042,"upstream_inference_completions_cost":0.0000033},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733858-zXu6rsGdHU6vwoDH9ubX","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1761733858-zXu6rsGdHU6vwoDH9ubX","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":140,"completion_tokens":11,"total_tokens":151,"cost":0.0000317,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000196,"upstream_inference_completions_cost":0.0000121},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -47,15 +49,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.891482334s + duration: 309.261709ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44100 + content_length: 42811 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -71,39 +73,45 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761682095-DfJt1uGLxquHbsD5eAk6","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733858-Cu0d3JZsrYvItxglBRoi","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733858-Cu0d3JZsrYvItxglBRoi","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"sourcegraph:0","type":"function","function":{"name":"sourcegraph","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733858-Cu0d3JZsrYvItxglBRoi","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"{\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682095-DfJt1uGLxquHbsD5eAk6","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.sourcegraph:0","type":"function","function":{"name":"sourcegraph","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733858-Cu0d3JZsrYvItxglBRoi","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"query"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682095-DfJt1uGLxquHbsD5eAk6","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"{\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733858-Cu0d3JZsrYvItxglBRoi","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682095-DfJt1uGLxquHbsD5eAk6","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"query"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733858-Cu0d3JZsrYvItxglBRoi","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682095-DfJt1uGLxquHbsD5eAk6","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"\":\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733858-Cu0d3JZsrYvItxglBRoi","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"lang"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682095-DfJt1uGLxquHbsD5eAk6","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"func"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733858-Cu0d3JZsrYvItxglBRoi","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682095-DfJt1uGLxquHbsD5eAk6","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":" main"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733858-Cu0d3JZsrYvItxglBRoi","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"go"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682095-DfJt1uGLxquHbsD5eAk6","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":" lang"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733858-Cu0d3JZsrYvItxglBRoi","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" func"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682095-DfJt1uGLxquHbsD5eAk6","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733858-Cu0d3JZsrYvItxglBRoi","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" main"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682095-DfJt1uGLxquHbsD5eAk6","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733858-Cu0d3JZsrYvItxglBRoi","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\","},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682095-DfJt1uGLxquHbsD5eAk6","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"\",\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733858-Cu0d3JZsrYvItxglBRoi","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682095-DfJt1uGLxquHbsD5eAk6","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"timeout"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733858-Cu0d3JZsrYvItxglBRoi","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"count"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682095-DfJt1uGLxquHbsD5eAk6","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733858-Cu0d3JZsrYvItxglBRoi","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682095-DfJt1uGLxquHbsD5eAk6","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"30"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733858-Cu0d3JZsrYvItxglBRoi","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" "},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682095-DfJt1uGLxquHbsD5eAk6","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":null,"type":"function","function":{"arguments":"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733858-Cu0d3JZsrYvItxglBRoi","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"10"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682095-DfJt1uGLxquHbsD5eAk6","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":""} + data: {"id":"gen-1761733858-Cu0d3JZsrYvItxglBRoi","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"}"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682095-DfJt1uGLxquHbsD5eAk6","provider":"SiliconFlow","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682095,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10230,"completion_tokens":24,"total_tokens":10254,"cost":0.00414,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.004092,"upstream_inference_completions_cost":0.000048},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733858-Cu0d3JZsrYvItxglBRoi","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733858-Cu0d3JZsrYvItxglBRoi","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733858,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10569,"completion_tokens":26,"total_tokens":10595,"cost":0.0016832,"is_byok":false,"prompt_tokens_details":{"cached_tokens":10496,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0016182,"upstream_inference_completions_cost":0.000065},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -112,7 +120,7 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 6.208471667s + duration: 2.725909791s - id: 2 request: proto: HTTP/1.1 @@ -120,7 +128,7 @@ interactions: proto_minor: 1 content_length: 424 host: sourcegraph.com - body: '{"query":"query Search($query: String!) { search(query: $query, version: V2, patternType: keyword ) { results { matchCount, limitHit, resultCount, approximateResultCount, missing { name }, timedout { name }, indexUnavailable, results { __typename, ... on FileMatch { repository { name }, file { path, url, content }, lineMatches { preview, lineNumber, offsetAndLengths } } } } } }","variables":{"query":"func main lang:go"}}' + body: '{"query":"query Search($query: String!) { search(query: $query, version: V2, patternType: keyword ) { results { matchCount, limitHit, resultCount, approximateResultCount, missing { name }, timedout { name }, indexUnavailable, results { __typename, ... on FileMatch { repository { name }, file { path, url, content }, lineMatches { preview, lineNumber, offsetAndLengths } } } } } }","variables":{"query":"lang:go func main"}}' headers: Content-Type: - application/json @@ -134,21 +142,21 @@ interactions: proto_minor: 0 content_length: -1 uncompressed: true - body: '{"data":{"search":{"results":{"matchCount":30,"limitHit":true,"resultCount":30,"approximateResultCount":"30+","missing":[],"timedout":[],"indexUnavailable":false,"results":[{"__typename":"FileMatch","repository":{"name":"github.com/jcalabro/uscope"},"file":{"path":"assets/gobacktrace/main.go","url":"/github.com/jcalabro/uscope/-/blob/assets/gobacktrace/main.go","content":"package main\n\nimport \"fmt\"\n\nfunc FuncE() {\n\tfmt.Println(\"FuncE\")\n}\n\nfunc FuncD() {\n\tFuncE()\n\tfmt.Println(\"FuncD\")\n}\n\nfunc FuncC() {\n\tFuncD()\n\tfmt.Println(\"FuncC\")\n}\n\nfunc FuncB() {\n\tFuncC()\n\tfmt.Println(\"FuncB\")\n}\n\nfunc FuncA() {\n\tFuncB()\n\tfmt.Println(\"FuncA\")\n}\n\nfunc FuncF() {\n\tfmt.Println(\"FuncF\")\n\tFuncE()\n}\n\nfunc main() {\n\tFuncA()\n\tFuncB()\n\tFuncC()\n\tFuncD()\n\tFuncE()\n\tFuncF()\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":33,"offsetAndLengths":[[0,9]]},{"preview":"\tFuncA()","lineNumber":34,"offsetAndLengths":[[1,4]]},{"preview":"\tFuncB()","lineNumber":35,"offsetAndLengths":[[1,4]]},{"preview":"\tFuncC()","lineNumber":36,"offsetAndLengths":[[1,4]]},{"preview":"\tFuncD()","lineNumber":37,"offsetAndLengths":[[1,4]]},{"preview":"\tFuncE()","lineNumber":38,"offsetAndLengths":[[1,4]]},{"preview":"\tFuncF()","lineNumber":39,"offsetAndLengths":[[1,4]]},{"preview":"func FuncE() {","lineNumber":4,"offsetAndLengths":[[0,4],[5,4]]},{"preview":"\tfmt.Println(\"FuncE\")","lineNumber":5,"offsetAndLengths":[[14,4]]},{"preview":"func FuncD() {","lineNumber":8,"offsetAndLengths":[[0,4],[5,4]]},{"preview":"\tFuncE()","lineNumber":9,"offsetAndLengths":[[1,4]]},{"preview":"\tfmt.Println(\"FuncD\")","lineNumber":10,"offsetAndLengths":[[14,4]]},{"preview":"func FuncC() {","lineNumber":13,"offsetAndLengths":[[0,4],[5,4]]},{"preview":"\tFuncD()","lineNumber":14,"offsetAndLengths":[[1,4]]},{"preview":"\tfmt.Println(\"FuncC\")","lineNumber":15,"offsetAndLengths":[[14,4]]},{"preview":"func FuncB() {","lineNumber":18,"offsetAndLengths":[[0,4],[5,4]]},{"preview":"\tFuncC()","lineNumber":19,"offsetAndLengths":[[1,4]]},{"preview":"\tfmt.Println(\"FuncB\")","lineNumber":20,"offsetAndLengths":[[14,4]]},{"preview":"func FuncA() {","lineNumber":23,"offsetAndLengths":[[0,4],[5,4]]},{"preview":"\tFuncB()","lineNumber":24,"offsetAndLengths":[[1,4]]},{"preview":"\tfmt.Println(\"FuncA\")","lineNumber":25,"offsetAndLengths":[[14,4]]},{"preview":"func FuncF() {","lineNumber":28,"offsetAndLengths":[[0,4],[5,4]]},{"preview":"\tfmt.Println(\"FuncF\")","lineNumber":29,"offsetAndLengths":[[14,4]]},{"preview":"\tFuncE()","lineNumber":30,"offsetAndLengths":[[1,4]]}]}]}}}}' + body: '{"data":{"search":{"results":{"matchCount":30,"limitHit":true,"resultCount":30,"approximateResultCount":"30+","missing":[],"timedout":[],"indexUnavailable":false,"results":[{"__typename":"FileMatch","repository":{"name":"github.com/GoesToEleven/GolangTraining"},"file":{"path":"14_functions/10_func-expression/01_before-func-expression/main.go","url":"/github.com/GoesToEleven/GolangTraining/-/blob/14_functions/10_func-expression/01_before-func-expression/main.go","content":"package main\n\nimport \"fmt\"\n\nfunc greeting() {\n\tfmt.Println(\"Hello world!\")\n}\n\nfunc main() {\n\tgreeting()\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":8,"offsetAndLengths":[[0,9]]},{"preview":"package main","lineNumber":0,"offsetAndLengths":[[8,4]]},{"preview":"func greeting() {","lineNumber":4,"offsetAndLengths":[[0,4]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/GoesToEleven/GolangTraining"},"file":{"path":"14_functions/10_func-expression/02_func-expression/main.go","url":"/github.com/GoesToEleven/GolangTraining/-/blob/14_functions/10_func-expression/02_func-expression/main.go","content":"package main\n\nimport \"fmt\"\n\nfunc main() {\n\n\tgreeting := func() {\n\t\tfmt.Println(\"Hello world!\")\n\t}\n\n\tgreeting()\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":4,"offsetAndLengths":[[0,9]]},{"preview":"\tgreeting := func() {","lineNumber":6,"offsetAndLengths":[[13,4]]},{"preview":"package main","lineNumber":0,"offsetAndLengths":[[8,4]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/jcalabro/uscope"},"file":{"path":"assets/gobacktrace/main.go","url":"/github.com/jcalabro/uscope/-/blob/assets/gobacktrace/main.go","content":"package main\n\nimport \"fmt\"\n\nfunc FuncE() {\n\tfmt.Println(\"FuncE\")\n}\n\nfunc FuncD() {\n\tFuncE()\n\tfmt.Println(\"FuncD\")\n}\n\nfunc FuncC() {\n\tFuncD()\n\tfmt.Println(\"FuncC\")\n}\n\nfunc FuncB() {\n\tFuncC()\n\tfmt.Println(\"FuncB\")\n}\n\nfunc FuncA() {\n\tFuncB()\n\tfmt.Println(\"FuncA\")\n}\n\nfunc FuncF() {\n\tfmt.Println(\"FuncF\")\n\tFuncE()\n}\n\nfunc main() {\n\tFuncA()\n\tFuncB()\n\tFuncC()\n\tFuncD()\n\tFuncE()\n\tFuncF()\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":33,"offsetAndLengths":[[0,9]]},{"preview":"\tFuncA()","lineNumber":34,"offsetAndLengths":[[1,4]]},{"preview":"\tFuncB()","lineNumber":35,"offsetAndLengths":[[1,4]]},{"preview":"\tFuncC()","lineNumber":36,"offsetAndLengths":[[1,4]]},{"preview":"\tFuncD()","lineNumber":37,"offsetAndLengths":[[1,4]]},{"preview":"\tFuncE()","lineNumber":38,"offsetAndLengths":[[1,4]]},{"preview":"\tFuncF()","lineNumber":39,"offsetAndLengths":[[1,4]]},{"preview":"func FuncE() {","lineNumber":4,"offsetAndLengths":[[0,4],[5,4]]},{"preview":"\tfmt.Println(\"FuncE\")","lineNumber":5,"offsetAndLengths":[[14,4]]},{"preview":"func FuncD() {","lineNumber":8,"offsetAndLengths":[[0,4],[5,4]]},{"preview":"\tFuncE()","lineNumber":9,"offsetAndLengths":[[1,4]]},{"preview":"\tfmt.Println(\"FuncD\")","lineNumber":10,"offsetAndLengths":[[14,4]]},{"preview":"func FuncC() {","lineNumber":13,"offsetAndLengths":[[0,4],[5,4]]},{"preview":"\tFuncD()","lineNumber":14,"offsetAndLengths":[[1,4]]},{"preview":"\tfmt.Println(\"FuncC\")","lineNumber":15,"offsetAndLengths":[[14,4]]},{"preview":"func FuncB() {","lineNumber":18,"offsetAndLengths":[[0,4],[5,4]]},{"preview":"\tFuncC()","lineNumber":19,"offsetAndLengths":[[1,4]]},{"preview":"\tfmt.Println(\"FuncB\")","lineNumber":20,"offsetAndLengths":[[14,4]]},{"preview":"func FuncA() {","lineNumber":23,"offsetAndLengths":[[0,4],[5,4]]}]}]}}}}' headers: Content-Type: - application/json status: 200 OK code: 200 - duration: 1.356186375s + duration: 1.364214834s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 51895 + content_length: 50508 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.sourcegraph:0\",\"function\":{\"arguments\":\"{\\\"query\\\":\\\"func main lang:go\\\",\\\"timeout\\\":30}\",\"name\":\"sourcegraph\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"# Sourcegraph Search Results\\n\\nFound 30 matches across 30 results\\n(Result limit reached, try a more specific query)\\n\\n## Result 1: github.com/jcalabro/uscope/assets/gobacktrace/main.go\\n\\nURL: /github.com/jcalabro/uscope/-/blob/assets/gobacktrace/main.go\\n\\n```\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| func main() {\\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| \\tFuncA()\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncB()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncC()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncD()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncE()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncF()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| func FuncE() {\\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| \\tfmt.Println(\\\"FuncE\\\")\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| func FuncD() {\\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| \\tFuncE()\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tfmt.Println(\\\"FuncD\\\")\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n```\\n\\n```\\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| func FuncC() {\\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n```\\n\\n```\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| \\tFuncD()\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n```\\n\\n```\\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tfmt.Println(\\\"FuncC\\\")\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n```\\n\\n```\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| func FuncB() {\\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n```\\n\\n```\\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| \\tFuncC()\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n```\\n\\n```\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tfmt.Println(\\\"FuncB\\\")\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n```\\n\\n```\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| func FuncA() {\\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n```\\n\\n```\\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| \\tFuncB()\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n```\\n\\n```\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tfmt.Println(\\\"FuncA\\\")\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n```\\n\\n```\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| func FuncF() {\\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n```\\n\\n```\\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| \\tfmt.Println(\\\"FuncF\\\")\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n```\\n\\n```\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tFuncE()\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n```\\n\\n\",\"tool_call_id\":\"functions.sourcegraph:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"sourcegraph:0\",\"function\":{\"arguments\":\"{\\\"query\\\": \\\"lang:go func main\\\", \\\"count\\\": 10}\",\"name\":\"sourcegraph\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"# Sourcegraph Search Results\\n\\nFound 30 matches across 30 results\\n(Result limit reached, try a more specific query)\\n\\n## Result 1: github.com/GoesToEleven/GolangTraining/14_functions/10_func-expression/01_before-func-expression/main.go\\n\\nURL: /github.com/GoesToEleven/GolangTraining/-/blob/14_functions/10_func-expression/01_before-func-expression/main.go\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func greeting() {\\n6| \\tfmt.Println(\\\"Hello world!\\\")\\n7| }\\n8| func main() {\\n9| func main() {\\n10| \\tgreeting()\\n11| }\\n12| \\n```\\n\\n```\\n0| package main\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func greeting() {\\n6| \\tfmt.Println(\\\"Hello world!\\\")\\n7| }\\n8| \\n9| func main() {\\n10| \\tgreeting()\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| func greeting() {\\n5| func greeting() {\\n6| \\tfmt.Println(\\\"Hello world!\\\")\\n7| }\\n8| \\n9| func main() {\\n10| \\tgreeting()\\n11| }\\n12| \\n```\\n\\n## Result 2: github.com/GoesToEleven/GolangTraining/14_functions/10_func-expression/02_func-expression/main.go\\n\\nURL: /github.com/GoesToEleven/GolangTraining/-/blob/14_functions/10_func-expression/02_func-expression/main.go\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| func main() {\\n5| func main() {\\n6| \\n7| \\tgreeting := func() {\\n8| \\t\\tfmt.Println(\\\"Hello world!\\\")\\n9| \\t}\\n10| \\n11| \\tgreeting()\\n12| }\\n13| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func main() {\\n6| \\tgreeting := func() {\\n7| \\tgreeting := func() {\\n8| \\t\\tfmt.Println(\\\"Hello world!\\\")\\n9| \\t}\\n10| \\n11| \\tgreeting()\\n12| }\\n13| \\n```\\n\\n```\\n0| package main\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func main() {\\n6| \\n7| \\tgreeting := func() {\\n8| \\t\\tfmt.Println(\\\"Hello world!\\\")\\n9| \\t}\\n10| \\n```\\n\\n## Result 3: github.com/jcalabro/uscope/assets/gobacktrace/main.go\\n\\nURL: /github.com/jcalabro/uscope/-/blob/assets/gobacktrace/main.go\\n\\n```\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| func main() {\\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| \\tFuncA()\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncB()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncC()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncD()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncE()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncF()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| func FuncE() {\\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| \\tfmt.Println(\\\"FuncE\\\")\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| func FuncD() {\\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| \\tFuncE()\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tfmt.Println(\\\"FuncD\\\")\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n```\\n\\n```\\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| func FuncC() {\\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n```\\n\\n```\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| \\tFuncD()\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n```\\n\\n```\\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tfmt.Println(\\\"FuncC\\\")\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n```\\n\\n```\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| func FuncB() {\\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n```\\n\\n```\\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| \\tFuncC()\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n```\\n\\n```\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tfmt.Println(\\\"FuncB\\\")\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n```\\n\\n```\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| func FuncA() {\\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n```\\n\\n\",\"tool_call_id\":\"sourcegraph:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -164,247 +172,99 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"Found"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"30"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" Go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" repositories"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" with"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" `"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"func"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"`."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" The"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" search"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" shows"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" various"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" implementations"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" including"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":":\n\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"-"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" **"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"github"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":".com"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"/j"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"cal"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"ab"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"ro"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"/usc"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"ope"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"**"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" -"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" A"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" call"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" stack"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" example"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" with"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" Func"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"A"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" through"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" Func"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"F"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"-"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" **"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"github"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":".com"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"/H"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"ar"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"per"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"era"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"/"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"ops"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"review"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"**"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" -"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" Go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" application"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"-"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" **"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"github"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":".com"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"/d"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"gh"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"ubble"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"/s"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"ling"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"**"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" -"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" HTTP"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" client"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" library"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"-"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" **"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"github"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":".com"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":"Found"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"/v"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"olatile"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":"30"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"tech"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" matches"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"/auth"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" across"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"boss"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" "},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"**"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":"30"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" -"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" Go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" Authentication"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" repositories"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" library"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" The"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"-"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" search"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" **"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" shows"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"github"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" various"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":".com"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" implementations"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"/cont"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" of"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"ain"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" `"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"rr"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":"func"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"r"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"/watch"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":"()`"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"tower"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" in"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"**"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" Go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" -"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" programs"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" Docker"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" container"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" including"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" watcher"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" basic"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"\n\n"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" examples"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"Most"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" from"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" `"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" G"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":"olang"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"()`"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":"Training"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" functions"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" tutorials"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" follow"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" Go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" applications"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" conventions"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" like"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" us"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" importing"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":"c"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" packages"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":"ope"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" and"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" that"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" calling"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" demonstrate"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" application"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" function"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"-specific"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" call"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":" functions"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":" patterns"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682105-0P98aAEUBRoJ5gGjG5wj","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682105,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":13706,"completion_tokens":119,"total_tokens":13825,"cost":0.0085211,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0082236,"upstream_inference_completions_cost":0.0002975},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733863-hnfx19rETay3BoYOBBBE","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733863,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":13262,"completion_tokens":45,"total_tokens":13307,"cost":0.0033465,"is_byok":false,"prompt_tokens_details":{"cached_tokens":10496,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.003234,"upstream_inference_completions_cost":0.0001125},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -413,4 +273,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 2.5525015s + duration: 2.259373959s diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/update_a_file.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/update_a_file.yaml index 7488b4c4ca9cb0615f9916a50b6295ca477a466f..79f595d0347d7420290b842a74c2de4163f4b863 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/update_a_file.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/update_a_file.yaml @@ -24,27 +24,27 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761681493-7gQZ1t7hsCm4fDQIs2VY","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733794-B3op6tEEbXbn8lanf34Q","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-7gQZ1t7hsCm4fDQIs2VY","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":"Update"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733794-B3op6tEEbXbn8lanf34Q","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":"Update"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-7gQZ1t7hsCm4fDQIs2VY","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733794-B3op6tEEbXbn8lanf34Q","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-7gQZ1t7hsCm4fDQIs2VY","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733794-B3op6tEEbXbn8lanf34Q","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-7gQZ1t7hsCm4fDQIs2VY","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733794-B3op6tEEbXbn8lanf34Q","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-7gQZ1t7hsCm4fDQIs2VY","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":" print"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733794-B3op6tEEbXbn8lanf34Q","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":" print"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-7gQZ1t7hsCm4fDQIs2VY","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":" hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733794-B3op6tEEbXbn8lanf34Q","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":" hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-7gQZ1t7hsCm4fDQIs2VY","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":" from"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733794-B3op6tEEbXbn8lanf34Q","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":" from"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-7gQZ1t7hsCm4fDQIs2VY","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":" crush"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733794-B3op6tEEbXbn8lanf34Q","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":" crush"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-7gQZ1t7hsCm4fDQIs2VY","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761733794-B3op6tEEbXbn8lanf34Q","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761681493-7gQZ1t7hsCm4fDQIs2VY","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":141,"completion_tokens":9,"total_tokens":150,"cost":0.000024,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000141,"upstream_inference_completions_cost":0.0000099},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733794-B3op6tEEbXbn8lanf34Q","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":141,"completion_tokens":9,"total_tokens":150,"cost":0.000024,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000141,"upstream_inference_completions_cost":0.0000099},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -53,15 +53,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 727.707458ms + duration: 508.559083ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44106 + content_length: 42817 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -77,57 +77,59 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"view","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"{\"file"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.view:0","index":0,"type":"function","function":{"name":"view","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"_path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"file"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":" \"/"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\"/"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"/update"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"_a"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/update"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"_file"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_a"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"/main"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_file"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":".go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/main"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.view:0","type":"function","function":{"name":"","arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":null} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681493-psDkdyONFDCisnVR6oXc","provider":"BaseTen","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681493,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10548,"completion_tokens":34,"total_tokens":10582,"cost":0.0064138,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0063288,"upstream_inference_completions_cost":0.000085},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + + data: {"id":"gen-1761733794-0skQfIJlGxncfol5PUrZ","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733794,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":9884,"completion_tokens":34,"total_tokens":9918,"cost":0.00391936,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00385476,"upstream_inference_completions_cost":0.0000646},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -136,15 +138,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.595768833s + duration: 1.583528291s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44535 + content_length: 43245 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"functions.view:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"functions.view:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -160,11 +162,113 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761681495-iKitQafRjpfaPC4SjbiZ","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681495,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"edit:1","type":"function","function":{"name":"edit"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"file"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"_path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\":\"/"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"/update"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"_a"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"_file"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"/main"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":".go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\",\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"old"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"_string"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\":\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\\"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"tf"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"mt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":".Println"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"(\\\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"Hello"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":","}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":" World"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"!\\"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\")"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761681495-iKitQafRjpfaPC4SjbiZ","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681495,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.edit:1","function":{"arguments":"{\"file_path\": \"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\", \"new_string\": \"\\tfmt.Println(\\\"Hello from Crush!\\\")\", \"old_string\": \"\\tfmt.Println(\\\"Hello, World!\\\")\"}","name":"edit"},"type":"function"}]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\",\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761681495-iKitQafRjpfaPC4SjbiZ","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681495,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":11139,"completion_tokens":50,"total_tokens":11189,"cost":0.0056695,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0055695,"upstream_inference_completions_cost":0.0001},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"new"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"_string"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\":\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\\"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"tf"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"mt"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":".Println"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"(\\\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"Hello"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":" from"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":" Crush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\\\")"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733797-mWbQYA1442uHRom6AkOH","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733797,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10670,"completion_tokens":59,"total_tokens":10729,"cost":0.0065495,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.006402,"upstream_inference_completions_cost":0.0001475},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -173,15 +277,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.421586166s + duration: 3.004846167s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45054 + content_length: 43738 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"functions.view:0\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"functions.edit:1\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\\", \\\"new_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello from Crush!\\\\\\\")\\\", \\\"old_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\"}\",\"name\":\"edit\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\n\\n\",\"tool_call_id\":\"functions.edit:1\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"functions.view:0\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"edit:1\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\\",\\\"old_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\",\\\"new_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello from Crush\\\\\\\")\\\"}\",\"name\":\"edit\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\n\\n\",\"tool_call_id\":\"edit:1\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -197,51 +301,49 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"bash:2","type":"function","function":{"name":"bash"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.bash:2","index":0,"type":"function","function":{"name":"bash","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"command"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"command"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":" run"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" run"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":" main"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" main"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":".go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\","}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\","}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"description"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"description"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":" the"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" the"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":" updated"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" updated"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":" Go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" Go"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":" program"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" program"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"type":"function","function":{"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} - data: {"id":"gen-1761681498-2oPkoJrqJbcH41sFU9rT","provider":"Novita","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681498,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":11091,"completion_tokens":29,"total_tokens":11120,"cost":0.0067271,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0066546,"upstream_inference_completions_cost":0.0000725},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733803-9WWVpuBzxSI21TFQql8t","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733803,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10092,"completion_tokens":30,"total_tokens":10122,"cost":0.0056403,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0055506,"upstream_inference_completions_cost":0.0000897},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -250,15 +352,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 2.814711292s + duration: 1.614020625s - id: 4 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45399 + content_length: 44102 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"functions.view:0\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"functions.edit:1\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\\", \\\"new_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello from Crush!\\\\\\\")\\\", \\\"old_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\"}\",\"name\":\"edit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\n\\n\",\"tool_call_id\":\"functions.edit:1\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"bash:2\",\"function\":{\"arguments\":\"{\\\"command\\\": \\\"go run main.go\\\", \\\"description\\\": \\\"Test the updated Go program\\\"}\",\"name\":\"bash\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"Hello from Crush!\\n\\n\\n/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file\",\"tool_call_id\":\"bash:2\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.view:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"functions.view:0\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"edit:1\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\\",\\\"old_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\",\\\"new_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello from Crush\\\\\\\")\\\"}\",\"name\":\"edit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file/main.go\\n\\n\",\"tool_call_id\":\"edit:1\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"functions.bash:2\",\"function\":{\"arguments\":\"{\\\"command\\\": \\\"go run main.go\\\", \\\"description\\\": \\\"Test the updated Go program\\\"}\",\"name\":\"bash\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"Hello from Crush\\n\\n\\n/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/update_a_file\",\"tool_call_id\":\"functions.bash:2\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -274,59 +376,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":"Done"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":" The"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":".go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":" file"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":" has"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":" been"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":" updated"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":" to"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":" print"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":" from"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":" Crush"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":"!\""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":" instead"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":" of"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":" \""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":","},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":" World"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":"!"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733806-2NafkUTE0uEvxnn1efgp","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733806,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":"\"."},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733806-2NafkUTE0uEvxnn1efgp","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733806,"choices":[{"index":0,"delta":{"role":"assistant","content":"Done"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761733806-2NafkUTE0uEvxnn1efgp","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733806,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} - data: {"id":"gen-1761681503-bo5Sdt3ajKWH7cbiW3eM","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761681503,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10434,"completion_tokens":25,"total_tokens":10459,"cost":0.00581345,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0057387,"upstream_inference_completions_cost":0.00007475},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733806-2NafkUTE0uEvxnn1efgp","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733806,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10164,"completion_tokens":2,"total_tokens":10166,"cost":0.00396776,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00396396,"upstream_inference_completions_cost":0.0000038},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -335,4 +391,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.044330666s + duration: 1.621653458s diff --git a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/write_tool.yaml b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/write_tool.yaml index b20a401f4c4dd8cdcda430abd5be2a79ce27c24c..9f22b831ee8e093440c57729f64b1699c016b95e 100644 --- a/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/write_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/openrouter-kimi-k2/write_tool.yaml @@ -24,19 +24,23 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761682113-nRNEZZYffaoHlmXYEb6Y","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-3cnLSj74PvP4wu6yDI8T","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682113-nRNEZZYffaoHlmXYEb6Y","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-3cnLSj74PvP4wu6yDI8T","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":"Create"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682113-nRNEZZYffaoHlmXYEb6Y","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":"Create"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-3cnLSj74PvP4wu6yDI8T","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":" config"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682113-nRNEZZYffaoHlmXYEb6Y","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":" config.json with name"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-3cnLSj74PvP4wu6yDI8T","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":".json"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682113-nRNEZZYffaoHlmXYEb6Y","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":" and version data"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-3cnLSj74PvP4wu6yDI8T","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":" with"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682113-nRNEZZYffaoHlmXYEb6Y","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761733868-3cnLSj74PvP4wu6yDI8T","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":" test"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} - data: {"id":"gen-1761682113-nRNEZZYffaoHlmXYEb6Y","provider":"DeepInfra","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":155,"completion_tokens":9,"total_tokens":164,"cost":0.0000316,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000217,"upstream_inference_completions_cost":0.0000099},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733868-3cnLSj74PvP4wu6yDI8T","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":" data"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + + data: {"id":"gen-1761733868-3cnLSj74PvP4wu6yDI8T","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + + data: {"id":"gen-1761733868-3cnLSj74PvP4wu6yDI8T","provider":"Chutes","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":155,"completion_tokens":7,"total_tokens":162,"cost":0.0000211,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0000155,"upstream_inference_completions_cost":0.0000056},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -45,15 +49,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 824.312625ms + duration: 1.005078167s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44143 + content_length: 42854 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -69,99 +73,101 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} + + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"write:0","type":"function","function":{"name":"write","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.write:0","index":0,"type":"function","function":{"name":"write","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"{\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"file"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"file"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_path"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_path"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \"/"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \"/"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"tmp"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"tmp"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/c"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/c"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"rush"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"rush"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-test"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/Test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/Test"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Coder"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Coder"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"Agent"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"Agent"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/open"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/open"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"router"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"router"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-k"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"imi"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"imi"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"-k"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"-k"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"2"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"2"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/write"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/write"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"_tool"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"_tool"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"/config"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"/config"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":".json"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":".json"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\","}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\","},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"content"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"content"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \"{\\\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \"{\\\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"name"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"name"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\\\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\\\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \\\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \\\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"test"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"test"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\\\","}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\\\","},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \\\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \\\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"version"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"version"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\\\":"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\\\":"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" \\\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":" \\\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"1"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"1"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"."}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"."},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"0"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"0"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"."}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"."},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"0"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"0"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\\\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"\\\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"}\""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"}\""},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"}"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"function":{"arguments":"}"},"type":"function"}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682113-gVoEcDbXoD4esOmLSoka","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682113,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10168,"completion_tokens":54,"total_tokens":10222,"cost":0.00575386,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0055924,"upstream_inference_completions_cost":0.00016146},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733868-M0J6NEeHwsU7G4K4KPxW","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733868,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10584,"completion_tokens":53,"total_tokens":10637,"cost":0.0017597,"is_byok":false,"prompt_tokens_details":{"cached_tokens":10496,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0016272,"upstream_inference_completions_cost":0.0001325},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -170,15 +176,15 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 1.063776625s + duration: 2.629372458s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44623 + content_length: 43314 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"functions.write:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/write_tool/config.json\\\", \\\"content\\\": \\\"{\\\\\\\"name\\\\\\\": \\\\\\\"test\\\\\\\", \\\\\\\"version\\\\\\\": \\\\\\\"1.0.0\\\\\\\"}\\\"}\",\"name\":\"write\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\nFile successfully written: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/write_tool/config.json\\n\",\"tool_call_id\":\"functions.write:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\",\"cache_control\":{\"type\":\"ephemeral\"}},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\"},{\"tool_calls\":[{\"id\":\"write:0\",\"function\":{\"arguments\":\"{\\\"file_path\\\": \\\"/tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/write_tool/config.json\\\", \\\"content\\\": \\\"{\\\\\\\"name\\\\\\\": \\\\\\\"test\\\\\\\", \\\\\\\"version\\\\\\\": \\\\\\\"1.0.0\\\\\\\"}\\\"}\",\"name\":\"write\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"\\nFile successfully written: /tmp/crush-test/TestCoderAgent/openrouter-kimi-k2/write_tool/config.json\\n\",\"tool_call_id\":\"write:0\",\"role\":\"tool\"}],\"model\":\"moonshotai/kimi-k2-0905\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"usage\":{\"include\":true},\"stream\":true}" headers: Accept: - application/json @@ -194,13 +200,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"gen-1761682115-0dVmmDW4wHYhjnajmege","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682115,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733873-pv82nfQvODNB1m28oWAw","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733873,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682115-0dVmmDW4wHYhjnajmege","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682115,"choices":[{"index":0,"delta":{"role":"assistant","content":"Done"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]} + data: {"id":"gen-1761733873-pv82nfQvODNB1m28oWAw","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733873,"choices":[{"index":0,"delta":{"role":"assistant","content":"Done"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682115-0dVmmDW4wHYhjnajmege","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682115,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]} + data: {"id":"gen-1761733873-pv82nfQvODNB1m28oWAw","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733873,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}],"system_fingerprint":"fpv0_41b1161c"} - data: {"id":"gen-1761682115-0dVmmDW4wHYhjnajmege","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761682115,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10266,"completion_tokens":2,"total_tokens":10268,"cost":0.00565228,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0056463,"upstream_inference_completions_cost":0.00000598},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} + data: {"id":"gen-1761733873-pv82nfQvODNB1m28oWAw","provider":"Moonshot AI","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761733873,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10682,"completion_tokens":2,"total_tokens":10684,"cost":0.001691,"is_byok":false,"prompt_tokens_details":{"cached_tokens":10496,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.001686,"upstream_inference_completions_cost":0.000005},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}} data: [DONE] @@ -209,4 +215,4 @@ interactions: - text/event-stream status: 200 OK code: 200 - duration: 998.472042ms + duration: 1.439386458s diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/bash_tool.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/bash_tool.yaml index bda571e55d315d3ba5baf3834e925363dac1c7f7..43a994336c4dcdd5d5f80d05e548ab6fca2a5c2d 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/bash_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/bash_tool.yaml @@ -24,19 +24,19 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029042638a2c68683068a4b3b","created":1761683198,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102918321999da3a024b8b4ea7","created":1761733940,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029042638a2c68683068a4b3b","created":1761683198,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Create"}}]} + data: {"id":"2025102918321999da3a024b8b4ea7","created":1761733940,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Create"}}]} - data: {"id":"20251029042638a2c68683068a4b3b","created":1761683198,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" bash"}}]} + data: {"id":"2025102918321999da3a024b8b4ea7","created":1761733940,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" bash"}}]} - data: {"id":"20251029042638a2c68683068a4b3b","created":1761683198,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" file"}}]} + data: {"id":"2025102918321999da3a024b8b4ea7","created":1761733940,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" file"}}]} - data: {"id":"20251029042638a2c68683068a4b3b","created":1761683198,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" without"}}]} + data: {"id":"2025102918321999da3a024b8b4ea7","created":1761733940,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" without"}}]} - data: {"id":"20251029042638a2c68683068a4b3b","created":1761683198,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" timestamp"}}]} + data: {"id":"2025102918321999da3a024b8b4ea7","created":1761733940,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" timestamp"}}]} - data: {"id":"20251029042638a2c68683068a4b3b","created":1761683198,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":140,"completion_tokens":9,"total_tokens":149,"prompt_tokens_details":{"cached_tokens":4}}} + data: {"id":"2025102918321999da3a024b8b4ea7","created":1761733940,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":140,"completion_tokens":9,"total_tokens":149,"prompt_tokens_details":{"cached_tokens":4}}} data: [DONE] @@ -45,15 +45,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 2.088014083s + duration: 656.420459ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44004 + content_length: 42715 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'. do not print its timestamp\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'. do not print its timestamp\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -69,13 +69,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"2025102904263884f814278cd44676","created":1761683198,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"202510291832205dab67d562f74cc9","created":1761733940,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"2025102904263884f814278cd44676","created":1761683198,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510291832205dab67d562f74cc9","created":1761733940,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"2025102904263884f814278cd44676","created":1761683198,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_a251d7717f9b4cf89a04d912","index":0,"type":"function","function":{"name":"bash","arguments":"{\"command\":\"echo 'hello bash' > test.txt\",\"description\":\"Create test.txt with content 'hello bash'\"}"}}]}}]} + data: {"id":"202510291832205dab67d562f74cc9","created":1761733940,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_2d203d1246c94ff59c6967e6","index":0,"type":"function","function":{"name":"bash","arguments":"{\"command\":\"echo 'hello bash' > test.txt\",\"description\":\"Create test.txt with 'hello bash' content\"}"}}]}}]} - data: {"id":"2025102904263884f814278cd44676","created":1761683198,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10583,"completion_tokens":40,"total_tokens":10623,"prompt_tokens_details":{"cached_tokens":45}}} + data: {"id":"202510291832205dab67d562f74cc9","created":1761733940,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10285,"completion_tokens":40,"total_tokens":10325,"prompt_tokens_details":{"cached_tokens":10232}}} data: [DONE] @@ -84,15 +84,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 3.108627792s + duration: 720.599208ms - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44347 + content_length: 43058 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'. do not print its timestamp\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_a251d7717f9b4cf89a04d912\",\"function\":{\"arguments\":\"{\\\"command\\\":\\\"echo 'hello bash' > test.txt\\\",\\\"description\\\":\\\"Create test.txt with content 'hello bash'\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"no output\",\"tool_call_id\":\"call_a251d7717f9b4cf89a04d912\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/bash_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use bash to create a file named test.txt with content 'hello bash'. do not print its timestamp\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_2d203d1246c94ff59c6967e6\",\"function\":{\"arguments\":\"{\\\"command\\\":\\\"echo 'hello bash' > test.txt\\\",\\\"description\\\":\\\"Create test.txt with 'hello bash' content\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"no output\",\"tool_call_id\":\"call_2d203d1246c94ff59c6967e6\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -108,35 +108,29 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029042640b65469857b234b7a","created":1761683200,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"2025102918322137ce4fa3db0f4fc8","created":1761733941,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"20251029042640b65469857b234b7a","created":1761683200,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102918322137ce4fa3db0f4fc8","created":1761733941,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029042640b65469857b234b7a","created":1761683200,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Done"}}]} + data: {"id":"2025102918322137ce4fa3db0f4fc8","created":1761733941,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Created"}}]} - data: {"id":"20251029042640b65469857b234b7a","created":1761683200,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} + data: {"id":"2025102918322137ce4fa3db0f4fc8","created":1761733941,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" test"}}]} - data: {"id":"20251029042640b65469857b234b7a","created":1761683200,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" File"}}]} + data: {"id":"2025102918322137ce4fa3db0f4fc8","created":1761733941,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".txt"}}]} - data: {"id":"20251029042640b65469857b234b7a","created":1761683200,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" test"}}]} + data: {"id":"2025102918322137ce4fa3db0f4fc8","created":1761733941,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} - data: {"id":"20251029042640b65469857b234b7a","created":1761683200,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".txt"}}]} + data: {"id":"2025102918322137ce4fa3db0f4fc8","created":1761733941,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" content"}}]} - data: {"id":"20251029042640b65469857b234b7a","created":1761683200,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" created"}}]} + data: {"id":"2025102918322137ce4fa3db0f4fc8","created":1761733941,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" '"}}]} - data: {"id":"20251029042640b65469857b234b7a","created":1761683200,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} + data: {"id":"2025102918322137ce4fa3db0f4fc8","created":1761733941,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"hello"}}]} - data: {"id":"20251029042640b65469857b234b7a","created":1761683200,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" content"}}]} + data: {"id":"2025102918322137ce4fa3db0f4fc8","created":1761733941,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" bash"}}]} - data: {"id":"20251029042640b65469857b234b7a","created":1761683200,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" '"}}]} + data: {"id":"2025102918322137ce4fa3db0f4fc8","created":1761733941,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"'."}}]} - data: {"id":"20251029042640b65469857b234b7a","created":1761683200,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"hello"}}]} - - data: {"id":"20251029042640b65469857b234b7a","created":1761683200,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" bash"}}]} - - data: {"id":"20251029042640b65469857b234b7a","created":1761683200,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"'."}}]} - - data: {"id":"20251029042640b65469857b234b7a","created":1761683200,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10631,"completion_tokens":17,"total_tokens":10648,"prompt_tokens_details":{"cached_tokens":10530}}} + data: {"id":"2025102918322137ce4fa3db0f4fc8","created":1761733941,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10333,"completion_tokens":14,"total_tokens":10347,"prompt_tokens_details":{"cached_tokens":43}}} data: [DONE] @@ -145,4 +139,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 1.119304208s + duration: 1.230338875s diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/download_tool.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/download_tool.yaml index f8c78ad08d8f16612f23cba8352aa471085fb876..6c1ac289f8a026d6480ae7df04071a8e373f620f 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/download_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/download_tool.yaml @@ -24,17 +24,23 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510290445484b084f61821f417c","created":1761684348,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251029183222c2929f83bb5a4d83","created":1761733942,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510290445484b084f61821f417c","created":1761684348,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Download"}}]} + data: {"id":"20251029183222c2929f83bb5a4d83","created":1761733942,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Download"}}]} - data: {"id":"202510290445484b084f61821f417c","created":1761684348,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" file"}}]} + data: {"id":"20251029183222c2929f83bb5a4d83","created":1761733942,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" file"}}]} - data: {"id":"202510290445484b084f61821f417c","created":1761684348,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" example"}}]} + data: {"id":"20251029183222c2929f83bb5a4d83","created":1761733942,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" from"}}]} - data: {"id":"202510290445484b084f61821f417c","created":1761684348,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":".txt"}}]} + data: {"id":"20251029183222c2929f83bb5a4d83","created":1761733942,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" URL"}}]} - data: {"id":"202510290445484b084f61821f417c","created":1761684348,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":143,"completion_tokens":8,"total_tokens":151,"prompt_tokens_details":{"cached_tokens":4}}} + data: {"id":"20251029183222c2929f83bb5a4d83","created":1761733942,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" and"}}]} + + data: {"id":"20251029183222c2929f83bb5a4d83","created":1761733942,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" save"}}]} + + data: {"id":"20251029183222c2929f83bb5a4d83","created":1761733942,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" locally"}}]} + + data: {"id":"20251029183222c2929f83bb5a4d83","created":1761733942,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":143,"completion_tokens":11,"total_tokens":154,"prompt_tokens_details":{"cached_tokens":114}}} data: [DONE] @@ -43,15 +49,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 2.283956959s + duration: 615.878792ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44029 + content_length: 42740 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -67,13 +73,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029044548f1d2981058ae449f","created":1761684348,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"20251029183222dac46479fbe14e3a","created":1761733942,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"20251029044548f1d2981058ae449f","created":1761684348,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251029183222dac46479fbe14e3a","created":1761733942,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029044548f1d2981058ae449f","created":1761684348,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_b1d435bf28b849668ed23cdb","index":0,"type":"function","function":{"name":"download","arguments":"{\"url\":\"https://example-files.online-convert.com/document/txt/example.txt\",\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/download_tool/example.txt\"}"}}]}}]} + data: {"id":"20251029183222dac46479fbe14e3a","created":1761733942,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_fce6343ca90343508dc8de0d","index":0,"type":"function","function":{"name":"download","arguments":"{\"url\":\"https://example-files.online-convert.com/document/txt/example.txt\",\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/download_tool/example.txt\"}"}}]}}]} - data: {"id":"20251029044548f1d2981058ae449f","created":1761684348,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10586,"completion_tokens":55,"total_tokens":10641,"prompt_tokens_details":{"cached_tokens":43}}} + data: {"id":"20251029183222dac46479fbe14e3a","created":1761733942,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10288,"completion_tokens":55,"total_tokens":10343,"prompt_tokens_details":{"cached_tokens":10232}}} data: [DONE] @@ -82,7 +88,7 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 2.795001042s + duration: 722.089ms - id: 2 request: proto: HTTP/1.1 @@ -128,15 +134,15 @@ interactions: - text/plain; charset=UTF-8 status: 200 OK code: 200 - duration: 178.194375ms + duration: 165.79825ms - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44515 + content_length: 43226 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_b1d435bf28b849668ed23cdb\",\"function\":{\"arguments\":\"{\\\"url\\\":\\\"https://example-files.online-convert.com/document/txt/example.txt\\\",\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/download_tool/example.txt\\\"}\",\"name\":\"download\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Successfully downloaded 2574 bytes to example.txt (Content-Type: text/plain; charset=UTF-8)\",\"tool_call_id\":\"call_b1d435bf28b849668ed23cdb\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/download_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"download the file from https://example-files.online-convert.com/document/txt/example.txt and save it as example.txt\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_fce6343ca90343508dc8de0d\",\"function\":{\"arguments\":\"{\\\"url\\\":\\\"https://example-files.online-convert.com/document/txt/example.txt\\\",\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/download_tool/example.txt\\\"}\",\"name\":\"download\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Successfully downloaded 2574 bytes to example.txt (Content-Type: text/plain; charset=UTF-8)\",\"tool_call_id\":\"call_fce6343ca90343508dc8de0d\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -152,23 +158,23 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029044550f51f83ccc0874031","created":1761684350,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"20251029183224b8beee8e779c49ba","created":1761733944,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"20251029044550f51f83ccc0874031","created":1761684350,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251029183224b8beee8e779c49ba","created":1761733944,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029044550f51f83ccc0874031","created":1761684350,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"File"}}]} + data: {"id":"20251029183224b8beee8e779c49ba","created":1761733944,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"File"}}]} - data: {"id":"20251029044550f51f83ccc0874031","created":1761684350,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" downloaded"}}]} + data: {"id":"20251029183224b8beee8e779c49ba","created":1761733944,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" downloaded"}}]} - data: {"id":"20251029044550f51f83ccc0874031","created":1761684350,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" successfully"}}]} + data: {"id":"20251029183224b8beee8e779c49ba","created":1761733944,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" successfully"}}]} - data: {"id":"20251029044550f51f83ccc0874031","created":1761684350,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" as"}}]} + data: {"id":"20251029183224b8beee8e779c49ba","created":1761733944,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" as"}}]} - data: {"id":"20251029044550f51f83ccc0874031","created":1761684350,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" example"}}]} + data: {"id":"20251029183224b8beee8e779c49ba","created":1761733944,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" example"}}]} - data: {"id":"20251029044550f51f83ccc0874031","created":1761684350,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".txt"}}]} + data: {"id":"20251029183224b8beee8e779c49ba","created":1761733944,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".txt"}}]} - data: {"id":"20251029044550f51f83ccc0874031","created":1761684350,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10668,"completion_tokens":11,"total_tokens":10679,"prompt_tokens_details":{"cached_tokens":10640}}} + data: {"id":"20251029183224b8beee8e779c49ba","created":1761733944,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10370,"completion_tokens":11,"total_tokens":10381,"prompt_tokens_details":{"cached_tokens":10232}}} data: [DONE] @@ -177,4 +183,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 862.226333ms + duration: 707.620583ms diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/fetch_tool.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/fetch_tool.yaml deleted file mode 100644 index 24b3662750ff2deb3cdae68d763f2b633ca91d91..0000000000000000000000000000000000000000 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/fetch_tool.yaml +++ /dev/null @@ -1,227 +0,0 @@ ---- -version: 2 -interactions: -- id: 0 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 799 - host: "" - body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nfetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word ''John Doe''\n \n\n","role":"user"}],"model":"glm-4.5-air","max_tokens":40,"stream_options":{"include_usage":true},"stream":true}' - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://api.z.ai/api/coding/paas/v4/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"20251029040934fc9dcd0e9d084bd4","created":1761682174,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"20251029040934fc9dcd0e9d084bd4","created":1761682174,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Check"}}]} - - data: {"id":"20251029040934fc9dcd0e9d084bd4","created":1761682174,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" HTML"}}]} - - data: {"id":"20251029040934fc9dcd0e9d084bd4","created":1761682174,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" for"}}]} - - data: {"id":"20251029040934fc9dcd0e9d084bd4","created":1761682174,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" '"}}]} - - data: {"id":"20251029040934fc9dcd0e9d084bd4","created":1761682174,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"John"}}]} - - data: {"id":"20251029040934fc9dcd0e9d084bd4","created":1761682174,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Doe"}}]} - - data: {"id":"20251029040934fc9dcd0e9d084bd4","created":1761682174,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"'"}}]} - - data: {"id":"20251029040934fc9dcd0e9d084bd4","created":1761682174,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":148,"completion_tokens":11,"total_tokens":159,"prompt_tokens_details":{"cached_tokens":114}}} - - data: [DONE] - - headers: - Content-Type: - - text/event-stream;charset=UTF-8 - status: 200 OK - code: 200 - duration: 1.106568667s -- id: 1 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 44047 - host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"fetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word 'John Doe'\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://api.z.ai/api/coding/paas/v4/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"2025102904093477f405a24b3b4dae","created":1761682174,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - - data: {"id":"2025102904093477f405a24b3b4dae","created":1761682174,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"2025102904093477f405a24b3b4dae","created":1761682174,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_687c9146b46d40afad3b0c74","index":0,"type":"function","function":{"name":"fetch","arguments":"{\"url\":\"https://example-files.online-convert.com/website/html/example.html\",\"format\":\"text\"}"}}]}}]} - - data: {"id":"2025102904093477f405a24b3b4dae","created":1761682174,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10593,"completion_tokens":37,"total_tokens":10630,"prompt_tokens_details":{"cached_tokens":10530}}} - - data: [DONE] - - headers: - Content-Type: - - text/event-stream;charset=UTF-8 - status: 200 OK - code: 200 - duration: 1.474064792s -- id: 2 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 0 - host: example-files.online-convert.com - headers: - User-Agent: - - crush/1.0 - url: https://example-files.online-convert.com/website/html/example.html - method: GET - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - uncompressed: true - body: |- - - - - - -

HTML test file

- -

Purpose: Provide example of this file type
- Document file type: HTML
- Version: 1.0
- Remark:

- -

- - Example content:
- The names "John Doe" for males, "Jane Doe" or "Jane Roe" for females, or "Jonnie Doe" and "Janie Doe" for children, or just "Doe" non-gender-specifically are used as placeholder names for a party whose true identity is unknown or must be withheld in a legal action, case, or discussion. The names are also used to refer to acorpse or hospital patient whose identity is unknown. This practice is widely used in the United States and Canada, but is rarely used in other English-speaking countries including the United Kingdom itself, from where the use of "John Doe" in a legal context originates. The names Joe Bloggs or John Smith are used in the UK instead, as well as in Australia and New Zealand.

- -

John Doe is sometimes used to refer to a typical male in other contexts as well, in a similar manner to John Q. Public, known in Great Britain as Joe Public, John Smith or Joe Bloggs. For example, the first name listed on a form is often John Doe, along with a fictional address or other fictional information to provide an example of how to fill in the form. The name is also used frequently in popular culture, for example in the Frank Capra film Meet John Doe. John Doe was also the name of a 2002 American television series.

- -

Similarly, a child or baby whose identity is unknown may be referred to as Baby Doe. A notorious murder case in Kansas City, Missouri, referred to the baby victim as Precious Doe. Other unidentified female murder victims are Cali Doe and Princess Doe. Additional persons may be called James Doe, Judy Doe, etc. However, to avoid possible confusion, if two anonymous or unknown parties are cited in a specific case or action, the surnames Doe and Roe may be used simultaneously; for example, "John Doe v. Jane Roe". If several anonymous parties are referenced, they may simply be labelled John Doe #1, John Doe #2, etc. (the U.S. Operation Delego cited 21 (numbered) "John Doe"s) or labelled with other variants of Doe / Roe / Poe / etc. Other early alternatives such as John Stiles and Richard Miles are now rarely used, and Mary Major has been used in some American federal cases.

- -

- - File created by https://www.online-convert.com
- More example files: https://www.online-convert.com/file-type
- Text of "Example content": Wikipedia
- License: Attribution-ShareAlike 3.0 Unported - -

- -

Feel free to use and share the file according to license above.

- - - - headers: - Content-Type: - - text/html; charset=UTF-8 - status: 200 OK - code: 200 - duration: 202.430291ms -- id: 3 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 46879 - host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/fetch_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"fetch the content from https://example-files.online-convert.com/website/html/example.html and tell me if it contains the word 'John Doe'\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_687c9146b46d40afad3b0c74\",\"function\":{\"arguments\":\"{\\\"url\\\":\\\"https://example-files.online-convert.com/website/html/example.html\\\",\\\"format\\\":\\\"text\\\"}\",\"name\":\"fetch\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"HTML test file Purpose: Provide example of this file type Document file type: HTML Version: 1.0 Remark: Example content: The names \\\"John Doe\\\" for males, \\\"Jane Doe\\\" or \\\"Jane Roe\\\" for females, or \\\"Jonnie Doe\\\" and \\\"Janie Doe\\\" for children, or just \\\"Doe\\\" non-gender-specifically are used as placeholder names for a party whose true identity is unknown or must be withheld in a legal action, case, or discussion. The names are also used to refer to acorpse or hospital patient whose identity is unknown. This practice is widely used in the United States and Canada, but is rarely used in other English-speaking countries including the United Kingdom itself, from where the use of \\\"John Doe\\\" in a legal context originates. The names Joe Bloggs or John Smith are used in the UK instead, as well as in Australia and New Zealand. John Doe is sometimes used to refer to a typical male in other contexts as well, in a similar manner to John Q. Public, known in Great Britain as Joe Public, John Smith or Joe Bloggs. For example, the first name listed on a form is often John Doe, along with a fictional address or other fictional information to provide an example of how to fill in the form. The name is also used frequently in popular culture, for example in the Frank Capra film Meet John Doe. John Doe was also the name of a 2002 American television series. Similarly, a child or baby whose identity is unknown may be referred to as Baby Doe. A notorious murder case in Kansas City, Missouri, referred to the baby victim as Precious Doe. Other unidentified female murder victims are Cali Doe and Princess Doe. Additional persons may be called James Doe, Judy Doe, etc. However, to avoid possible confusion, if two anonymous or unknown parties are cited in a specific case or action, the surnames Doe and Roe may be used simultaneously; for example, \\\"John Doe v. Jane Roe\\\". If several anonymous parties are referenced, they may simply be labelled John Doe #1, John Doe #2, etc. (the U.S. Operation Delego cited 21 (numbered) \\\"John Doe\\\"s) or labelled with other variants of Doe / Roe / Poe / etc. Other early alternatives such as John Stiles and Richard Miles are now rarely used, and Mary Major has been used in some American federal cases. File created by https://www.online-convert.com More example files: https://www.online-convert.com/file-type Text of \\\"Example content\\\": Wikipedia License: Attribution-ShareAlike 3.0 Unported Feel free to use and share the file according to license above.\",\"tool_call_id\":\"call_687c9146b46d40afad3b0c74\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://api.z.ai/api/coding/paas/v4/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"20251029040937602437c756564d5a","created":1761682177,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - - data: {"id":"20251029040937602437c756564d5a","created":1761682177,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"20251029040937602437c756564d5a","created":1761682177,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Yes"}}]} - - data: {"id":"20251029040937602437c756564d5a","created":1761682177,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} - - data: {"id":"20251029040937602437c756564d5a","created":1761682177,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} - - data: {"id":"20251029040937602437c756564d5a","created":1761682177,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" content"}}]} - - data: {"id":"20251029040937602437c756564d5a","created":1761682177,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" contains"}}]} - - data: {"id":"20251029040937602437c756564d5a","created":1761682177,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} - - data: {"id":"20251029040937602437c756564d5a","created":1761682177,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" word"}}]} - - data: {"id":"20251029040937602437c756564d5a","created":1761682177,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} - - data: {"id":"20251029040937602437c756564d5a","created":1761682177,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"John"}}]} - - data: {"id":"20251029040937602437c756564d5a","created":1761682177,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Doe"}}]} - - data: {"id":"20251029040937602437c756564d5a","created":1761682177,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\""}}]} - - data: {"id":"20251029040937602437c756564d5a","created":1761682177,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" multiple"}}]} - - data: {"id":"20251029040937602437c756564d5a","created":1761682177,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" times"}}]} - - data: {"id":"20251029040937602437c756564d5a","created":1761682177,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} - - data: {"id":"20251029040937602437c756564d5a","created":1761682177,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":11187,"completion_tokens":19,"total_tokens":11206,"prompt_tokens_details":{"cached_tokens":10530}}} - - data: [DONE] - - headers: - Content-Type: - - text/event-stream;charset=UTF-8 - status: 200 OK - code: 200 - duration: 670.3935ms diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/glob_tool.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/glob_tool.yaml index 49468c20506ac87c5a87cb92c8288afe302ee9c6..6de38ad83e6af635c9a97eb5f5bd8e1ac54fc6fe 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/glob_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/glob_tool.yaml @@ -24,23 +24,19 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029040937cd04c81a23504486","created":1761682178,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510291832256fd7b966e3e844f6","created":1761733945,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029040937cd04c81a23504486","created":1761682178,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Find"}}]} + data: {"id":"202510291832256fd7b966e3e844f6","created":1761733945,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Find"}}]} - data: {"id":"20251029040937cd04c81a23504486","created":1761682178,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" all"}}]} + data: {"id":"202510291832256fd7b966e3e844f6","created":1761733945,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} - data: {"id":"20251029040937cd04c81a23504486","created":1761682178,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" ."}}]} + data: {"id":"202510291832256fd7b966e3e844f6","created":1761733945,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" files"}}]} - data: {"id":"20251029040937cd04c81a23504486","created":1761682178,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"go"}}]} + data: {"id":"202510291832256fd7b966e3e844f6","created":1761733945,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} - data: {"id":"20251029040937cd04c81a23504486","created":1761682178,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" files"}}]} + data: {"id":"202510291832256fd7b966e3e844f6","created":1761733945,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" glob"}}]} - data: {"id":"20251029040937cd04c81a23504486","created":1761682178,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} - - data: {"id":"20251029040937cd04c81a23504486","created":1761682178,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" glob"}}]} - - data: {"id":"20251029040937cd04c81a23504486","created":1761682178,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":132,"completion_tokens":11,"total_tokens":143,"prompt_tokens_details":{"cached_tokens":114}}} + data: {"id":"202510291832256fd7b966e3e844f6","created":1761733945,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":132,"completion_tokens":9,"total_tokens":141,"prompt_tokens_details":{"cached_tokens":4}}} data: [DONE] @@ -49,15 +45,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 666.317458ms + duration: 761.177208ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 43965 + content_length: 42676 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -73,217 +69,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"The"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" user"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" wants"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" me"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" glob"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" tool"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" find"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" all"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" ."}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"go"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" files"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" in"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" current"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" directory"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" need"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" glob"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" tool"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" with"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" pattern"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" \"*."}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"go"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"\""}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" find"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Go"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" files"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" in"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" current"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" working"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" directory"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".\n\n"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"According"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" glob"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" tool"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" documentation"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":":\n"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" pattern"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" should"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" be"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" \"*."}}]} + data: {"id":"20251029183225df4184bcc70c414d","created":1761733945,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"go"}}]} + data: {"id":"20251029183225df4184bcc70c414d","created":1761733945,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"\""}}]} + data: {"id":"20251029183225df4184bcc70c414d","created":1761733945,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_773d6a354f0b45e3bca5c02e","index":0,"type":"function","function":{"name":"glob","arguments":"{\"pattern\":\"*.go\"}"}}]}}]} - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":" \n"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" path"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" is"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" optional"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" and"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" defaults"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" current"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" working"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" directory"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Results"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" are"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" sorted"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" by"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" modification"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" time"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" ("}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"new"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"est"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" first"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":")\n"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Max"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":" "}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"100"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" files"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n\n"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"This"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" is"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" straightforward"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" -"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"'ll"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" call"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" glob"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" tool"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" with"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" pattern"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" \"*."}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"go"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"\"."}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_e517186605bc4615a9e2731b","index":0,"type":"function","function":{"name":"glob","arguments":"{\"pattern\":\"*.go\"}"}}]}}]} - - data: {"id":"20251029040937a8013fd9942f4de2","created":1761682178,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10576,"completion_tokens":120,"total_tokens":10696,"prompt_tokens_details":{"cached_tokens":10530}}} + data: {"id":"20251029183225df4184bcc70c414d","created":1761733945,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10278,"completion_tokens":18,"total_tokens":10296,"prompt_tokens_details":{"cached_tokens":10232}}} data: [DONE] @@ -292,15 +84,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 696.640292ms + duration: 825.850125ms - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44272 + content_length: 42983 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_e517186605bc4615a9e2731b\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/glob_tool/main.go\",\"tool_call_id\":\"call_e517186605bc4615a9e2731b\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/glob_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files in the current directory\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_773d6a354f0b45e3bca5c02e\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/glob_tool/main.go\",\"tool_call_id\":\"call_773d6a354f0b45e3bca5c02e\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -316,49 +108,31 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/tmp"}}]} - - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/c"}}]} - - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"rush"}}]} - - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"-test"}}]} - - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/Test"}}]} - - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Coder"}}]} - - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Agent"}}]} - - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/z"}}]} + data: {"id":"20251029183226dff1c2390a7c49fa","created":1761733946,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"ai"}}]} + data: {"id":"20251029183226dff1c2390a7c49fa","created":1761733946,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"-g"}}]} + data: {"id":"20251029183226dff1c2390a7c49fa","created":1761733946,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Found"}}]} - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"lm"}}]} + data: {"id":"20251029183226dff1c2390a7c49fa","created":1761733946,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" "}}]} - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"4"}}]} + data: {"id":"20251029183226dff1c2390a7c49fa","created":1761733946,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"1"}}]} - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} + data: {"id":"20251029183226dff1c2390a7c49fa","created":1761733946,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"6"}}]} + data: {"id":"20251029183226dff1c2390a7c49fa","created":1761733946,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" file"}}]} - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/g"}}]} + data: {"id":"20251029183226dff1c2390a7c49fa","created":1761733946,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":":"}}]} - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"lob"}}]} + data: {"id":"20251029183226dff1c2390a7c49fa","created":1761733946,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" `"}}]} - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"_tool"}}]} + data: {"id":"20251029183226dff1c2390a7c49fa","created":1761733946,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"main"}}]} - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/main"}}]} + data: {"id":"20251029183226dff1c2390a7c49fa","created":1761733946,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} + data: {"id":"20251029183226dff1c2390a7c49fa","created":1761733946,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"`"}}]} - data: {"id":"20251029040940ea8291e4db4b499a","created":1761682180,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10619,"completion_tokens":24,"total_tokens":10643,"prompt_tokens_details":{"cached_tokens":10530}}} + data: {"id":"20251029183226dff1c2390a7c49fa","created":1761733946,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10321,"completion_tokens":15,"total_tokens":10336,"prompt_tokens_details":{"cached_tokens":10232}}} data: [DONE] @@ -367,4 +141,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 897.050125ms + duration: 756.444708ms diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/grep_tool.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/grep_tool.yaml index 27b6d6ad571d2fb7bd1b9a2826527247a7469360..38a2c104a28b39a79ce08badf66eee6f46603970 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/grep_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/grep_tool.yaml @@ -6,9 +6,9 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 716 + content_length: 42674 host: "" - body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nuse grep to search for the word ''package'' in go files\n \n\n","role":"user"}],"model":"glm-4.5-air","max_tokens":40,"stream_options":{"include_usage":true},"stream":true}' + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -24,23 +24,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510290413195778ff6437db499f","created":1761682399,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"202510290413195778ff6437db499f","created":1761682399,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"G"}}]} - - data: {"id":"202510290413195778ff6437db499f","created":1761682399,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"rep"}}]} - - data: {"id":"202510290413195778ff6437db499f","created":1761682399,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" for"}}]} - - data: {"id":"202510290413195778ff6437db499f","created":1761682399,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" package"}}]} - - data: {"id":"202510290413195778ff6437db499f","created":1761682399,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" in"}}]} + data: {"id":"202510291832276c8a6145c6c64a22","created":1761733947,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"202510290413195778ff6437db499f","created":1761682399,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} + data: {"id":"202510291832276c8a6145c6c64a22","created":1761733947,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510290413195778ff6437db499f","created":1761682399,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" files"}}]} + data: {"id":"202510291832276c8a6145c6c64a22","created":1761733947,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_a1ddeeb8a5f84a93b0b3c4d2","index":0,"type":"function","function":{"name":"grep","arguments":"{\"include\":\"*.go\",\"pattern\":\"package\"}"}}]}}]} - data: {"id":"202510290413195778ff6437db499f","created":1761682399,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":133,"completion_tokens":11,"total_tokens":144,"prompt_tokens_details":{"cached_tokens":115}}} + data: {"id":"202510291832276c8a6145c6c64a22","created":1761733947,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10279,"completion_tokens":26,"total_tokens":10305,"prompt_tokens_details":{"cached_tokens":10232}}} data: [DONE] @@ -49,15 +39,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 2.113607708s + duration: 674.027708ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 43963 + content_length: 716 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nuse grep to search for the word ''package'' in go files\n \n\n","role":"user"}],"model":"glm-4.5-air","max_tokens":40,"stream_options":{"include_usage":true},"stream":true}' headers: Accept: - application/json @@ -73,13 +63,17 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"2025102904131962eb6b800c474f83","created":1761682399,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"202510291832277139fecd64054e23","created":1761733947,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + + data: {"id":"202510291832277139fecd64054e23","created":1761733947,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"grep"}}]} + + data: {"id":"202510291832277139fecd64054e23","created":1761733947,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" package"}}]} - data: {"id":"2025102904131962eb6b800c474f83","created":1761682399,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510291832277139fecd64054e23","created":1761733947,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" *."}}]} - data: {"id":"2025102904131962eb6b800c474f83","created":1761682399,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_b76fbce3204b46f396c1f054","index":0,"type":"function","function":{"name":"grep","arguments":"{\"include\":\"*.go\",\"literal_text\":true,\"pattern\":\"package\"}"}}]}}]} + data: {"id":"202510291832277139fecd64054e23","created":1761733947,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"go"}}]} - data: {"id":"2025102904131962eb6b800c474f83","created":1761682399,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10577,"completion_tokens":35,"total_tokens":10612,"prompt_tokens_details":{"cached_tokens":10531}}} + data: {"id":"202510291832277139fecd64054e23","created":1761733947,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":133,"completion_tokens":8,"total_tokens":141,"prompt_tokens_details":{"cached_tokens":115}}} data: [DONE] @@ -88,15 +82,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 2.482402792s + duration: 764.02725ms - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44368 + content_length: 43057 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_b76fbce3204b46f396c1f054\",\"function\":{\"arguments\":\"{\\\"include\\\":\\\"*.go\\\",\\\"literal_text\\\":true,\\\"pattern\\\":\\\"package\\\"}\",\"name\":\"grep\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Found 1 matches\\n/tmp/crush-test/TestCoderAgent/zai-glm4.6/grep_tool/main.go:\\n Line 1, Char 1: package main\\n\",\"tool_call_id\":\"call_b76fbce3204b46f396c1f054\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/grep_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use grep to search for the word 'package' in go files\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_a1ddeeb8a5f84a93b0b3c4d2\",\"function\":{\"arguments\":\"{\\\"include\\\":\\\"*.go\\\",\\\"pattern\\\":\\\"package\\\"}\",\"name\":\"grep\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"Found 1 matches\\n/tmp/crush-test/TestCoderAgent/zai-glm4.6/grep_tool/main.go:\\n Line 1, Char 1: package main\\n\",\"tool_call_id\":\"call_a1ddeeb8a5f84a93b0b3c4d2\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -112,77 +106,43 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Found"}}]} - - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" "}}]} - - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"1"}}]} - - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" match"}}]} - - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" in"}}]} - - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" `/"}}]} - - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"tmp"}}]} - - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/c"}}]} - - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"rush"}}]} - - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"-test"}}]} - - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/Test"}}]} - - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Coder"}}]} - - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Agent"}}]} - - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/z"}}]} - - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"ai"}}]} - - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"-g"}}]} + data: {"id":"20251029183228ff924610c8a44d43","created":1761733948,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"lm"}}]} + data: {"id":"20251029183228ff924610c8a44d43","created":1761733948,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"4"}}]} + data: {"id":"20251029183228ff924610c8a44d43","created":1761733948,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Found"}}]} - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} + data: {"id":"20251029183228ff924610c8a44d43","created":1761733948,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" "}}]} - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"6"}}]} + data: {"id":"20251029183228ff924610c8a44d43","created":1761733948,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"1"}}]} - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/g"}}]} + data: {"id":"20251029183228ff924610c8a44d43","created":1761733948,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" match"}}]} - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"rep"}}]} + data: {"id":"20251029183228ff924610c8a44d43","created":1761733948,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":":"}}]} - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"_tool"}}]} + data: {"id":"20251029183228ff924610c8a44d43","created":1761733948,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" `"}}]} - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/main"}}]} + data: {"id":"20251029183228ff924610c8a44d43","created":1761733948,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"main"}}]} - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} + data: {"id":"20251029183228ff924610c8a44d43","created":1761733948,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":":"}}]} + data: {"id":"20251029183228ff924610c8a44d43","created":1761733948,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":":"}}]} - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"1"}}]} + data: {"id":"20251029183228ff924610c8a44d43","created":1761733948,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"1"}}]} - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"`"}}]} + data: {"id":"20251029183228ff924610c8a44d43","created":1761733948,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"`"}}]} - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" -"}}]} + data: {"id":"20251029183228ff924610c8a44d43","created":1761733948,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" contains"}}]} - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} + data: {"id":"20251029183228ff924610c8a44d43","created":1761733948,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"package"}}]} + data: {"id":"20251029183228ff924610c8a44d43","created":1761733948,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"package"}}]} - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} + data: {"id":"20251029183228ff924610c8a44d43","created":1761733948,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\""}}]} + data: {"id":"20251029183228ff924610c8a44d43","created":1761733948,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\""}}]} - data: {"id":"20251029041320f960ca9c5cc540f0","created":1761682400,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10654,"completion_tokens":38,"total_tokens":10692,"prompt_tokens_details":{"cached_tokens":10594}}} + data: {"id":"20251029183228ff924610c8a44d43","created":1761733948,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10347,"completion_tokens":21,"total_tokens":10368,"prompt_tokens_details":{"cached_tokens":10304}}} data: [DONE] @@ -191,4 +151,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 888.354416ms + duration: 680.335375ms diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/ls_tool.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/ls_tool.yaml index 089332cfeaa3ddc8a3020c80aacfe2db2ef7361d..0b7ced076f0691e8d055a722d8d3d1ddda788e99 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/ls_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/ls_tool.yaml @@ -6,9 +6,9 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 712 + content_length: 42668 host: "" - body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nuse ls to list the files in the current directory\n \n\n","role":"user"}],"model":"glm-4.5-air","max_tokens":40,"stream_options":{"include_usage":true},"stream":true}' + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -24,19 +24,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029040944a71b1eb513d74ad2","created":1761682184,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"20251029040944a71b1eb513d74ad2","created":1761682184,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"List"}}]} - - data: {"id":"20251029040944a71b1eb513d74ad2","created":1761682184,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" files"}}]} - - data: {"id":"20251029040944a71b1eb513d74ad2","created":1761682184,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} + data: {"id":"202510291832295d7a8181ee8c4b1a","created":1761733949,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"20251029040944a71b1eb513d74ad2","created":1761682184,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" ls"}}]} + data: {"id":"202510291832295d7a8181ee8c4b1a","created":1761733949,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029040944a71b1eb513d74ad2","created":1761682184,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" command"}}]} + data: {"id":"202510291832295d7a8181ee8c4b1a","created":1761733949,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_4946c38e460e43218876256e","index":0,"type":"function","function":{"name":"ls","arguments":"{\"path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/ls_tool\"}"}}]}}]} - data: {"id":"20251029040944a71b1eb513d74ad2","created":1761682184,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":130,"completion_tokens":9,"total_tokens":139,"prompt_tokens_details":{"cached_tokens":115}}} + data: {"id":"202510291832295d7a8181ee8c4b1a","created":1761733949,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10276,"completion_tokens":33,"total_tokens":10309,"prompt_tokens_details":{"cached_tokens":10232}}} data: [DONE] @@ -45,15 +39,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 676.153208ms + duration: 752.273458ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 43957 + content_length: 712 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n\n- ensure it is not more than 50 characters long\n- the title should be a summary of the user''s message\n- it should be one line long\n- do not use quotes or colons\n- the entire text you return will be used as the title\n- never return anything that is more than one sentence (one line) long\n\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nuse ls to list the files in the current directory\n \n\n","role":"user"}],"model":"glm-4.5-air","max_tokens":40,"stream_options":{"include_usage":true},"stream":true}' headers: Accept: - application/json @@ -69,137 +63,19 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"The"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" user"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" wants"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" me"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" ls"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" tool"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" list"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" files"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" in"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" current"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" directory"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" This"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" is"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" a"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" simple"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" request"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" that"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" can"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" fulfill"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" directly"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" with"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" ls"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" tool"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" The"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" current"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" working"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" directory"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" is"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" \"/"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"tmp"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"/c"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"rush"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-test"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"/Test"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"Coder"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"Agent"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"/z"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"ai"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-g"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"lm"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"4"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"6"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"/"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"ls"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"_tool"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"\""}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" according"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + data: {"id":"202510291832292cb3b1c1d09c42b5","created":1761733949,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" environment"}}]} + data: {"id":"202510291832292cb3b1c1d09c42b5","created":1761733949,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"List"}}]} - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" info"}}]} + data: {"id":"202510291832292cb3b1c1d09c42b5","created":1761733949,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" files"}}]} - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} + data: {"id":"202510291832292cb3b1c1d09c42b5","created":1761733949,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510291832292cb3b1c1d09c42b5","created":1761733949,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" ls"}}]} - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_4fe7b05528f5499ca4550974","index":0,"type":"function","function":{"name":"ls","arguments":"{}"}}]}}]} + data: {"id":"202510291832292cb3b1c1d09c42b5","created":1761733949,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" command"}}]} - data: {"id":"20251029040944d4b129b09ba34dd0","created":1761682184,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10574,"completion_tokens":71,"total_tokens":10645,"prompt_tokens_details":{"cached_tokens":10530}}} + data: {"id":"202510291832292cb3b1c1d09c42b5","created":1761733949,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":130,"completion_tokens":9,"total_tokens":139,"prompt_tokens_details":{"cached_tokens":4}}} data: [DONE] @@ -208,15 +84,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 704.451333ms + duration: 798.709833ms - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44264 + content_length: 43037 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_4fe7b05528f5499ca4550974\",\"function\":{\"arguments\":\"{}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/zai-glm4.6/ls_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_4fe7b05528f5499ca4550974\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/ls_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use ls to list the files in the current directory\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_4946c38e460e43218876256e\",\"function\":{\"arguments\":\"{\\\"path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/ls_tool\\\"}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/zai-glm4.6/ls_tool/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_4946c38e460e43218876256e\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -232,21 +108,21 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029040945bfa83ceda6284e4c","created":1761682185,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"2025102918323001ef9842c2904e8b","created":1761733950,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"20251029040945bfa83ceda6284e4c","created":1761682185,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102918323001ef9842c2904e8b","created":1761733950,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029040945bfa83ceda6284e4c","created":1761682185,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"go"}}]} + data: {"id":"2025102918323001ef9842c2904e8b","created":1761733950,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"go"}}]} - data: {"id":"20251029040945bfa83ceda6284e4c","created":1761682185,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".mod"}}]} + data: {"id":"2025102918323001ef9842c2904e8b","created":1761733950,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".mod"}}]} - data: {"id":"20251029040945bfa83ceda6284e4c","created":1761682185,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} + data: {"id":"2025102918323001ef9842c2904e8b","created":1761733950,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} - data: {"id":"20251029040945bfa83ceda6284e4c","created":1761682185,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} + data: {"id":"2025102918323001ef9842c2904e8b","created":1761733950,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} - data: {"id":"20251029040945bfa83ceda6284e4c","created":1761682185,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} + data: {"id":"2025102918323001ef9842c2904e8b","created":1761733950,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} - data: {"id":"20251029040945bfa83ceda6284e4c","created":1761682185,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10618,"completion_tokens":10,"total_tokens":10628,"prompt_tokens_details":{"cached_tokens":10576}}} + data: {"id":"2025102918323001ef9842c2904e8b","created":1761733950,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10344,"completion_tokens":10,"total_tokens":10354,"prompt_tokens_details":{"cached_tokens":10308}}} data: [DONE] @@ -255,4 +131,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 890.370958ms + duration: 681.367541ms diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/multiedit_tool.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/multiedit_tool.yaml index a5238e1b90783b717939302c499879bd164ed9ab..3e0285a1ac27de0125826b7c22c801b4691293e2 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/multiedit_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/multiedit_tool.yaml @@ -24,21 +24,21 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510290409463baf4757f0a7436b","created":1761682186,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102918323136c292c30b5948ee","created":1761733951,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510290409463baf4757f0a7436b","created":1761682186,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Mult"}}]} + data: {"id":"2025102918323136c292c30b5948ee","created":1761733951,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Edit"}}]} - data: {"id":"202510290409463baf4757f0a7436b","created":1761682186,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"ied"}}]} + data: {"id":"2025102918323136c292c30b5948ee","created":1761733951,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} - data: {"id":"202510290409463baf4757f0a7436b","created":1761682186,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"it"}}]} + data: {"id":"2025102918323136c292c30b5948ee","created":1761733951,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" greeting"}}]} - data: {"id":"202510290409463baf4757f0a7436b","created":1761682186,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} + data: {"id":"2025102918323136c292c30b5948ee","created":1761733951,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" and"}}]} - data: {"id":"202510290409463baf4757f0a7436b","created":1761682186,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Code"}}]} + data: {"id":"2025102918323136c292c30b5948ee","created":1761733951,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" add"}}]} - data: {"id":"202510290409463baf4757f0a7436b","created":1761682186,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Modification"}}]} + data: {"id":"2025102918323136c292c30b5948ee","created":1761733951,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" comment"}}]} - data: {"id":"202510290409463baf4757f0a7436b","created":1761682186,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":153,"completion_tokens":10,"total_tokens":163,"prompt_tokens_details":{"cached_tokens":4}}} + data: {"id":"2025102918323136c292c30b5948ee","created":1761733951,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":153,"completion_tokens":10,"total_tokens":163,"prompt_tokens_details":{"cached_tokens":115}}} data: [DONE] @@ -47,15 +47,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 669.678208ms + duration: 807.196625ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44043 + content_length: 42754 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -71,69 +71,199 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"The"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"I"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" user"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"'ll"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" wants"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" help"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" me"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" you"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" modify"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" mult"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"ied"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" file"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"it"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" using"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" tool"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" mult"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":":\n"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"ied"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"1"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"it"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" tool"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Change"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" '"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Let"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"Hello"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" me"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" first"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" World"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" read"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"!'"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" file"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" '"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" to"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"Hello"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" see"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" its"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Crush"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" current"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"!'\n"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" contents"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"2"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".\n"}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_c0088f90b4c148d686120b52","index":0,"type":"function","function":{"name":"view","arguments":"{\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\"}"}}]}}]} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Add"}}]} - data: {"id":"2025102904094691a6edffe2044cf5","created":1761682186,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10599,"completion_tokens":66,"total_tokens":10665,"prompt_tokens_details":{"cached_tokens":10530}}} + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" a"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" comment"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" '//"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" G"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"reeting"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"'"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" above"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" fmt"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".Println"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" line"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" in"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".go"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n\n"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"First"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" need"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" read"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".go"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" file"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" understand"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" its"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" current"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" state"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" and"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" structure"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" then"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" mult"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"ied"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"it"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" make"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" both"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" changes"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" in"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" one"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" operation"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".\n\n"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"Let"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" me"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" start"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" by"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" viewing"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".go"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" file"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" see"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" what"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"'s"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" currently"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" in"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" it"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_013f54c8c7bd47a48b924c06","index":0,"type":"function","function":{"name":"view","arguments":"{\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\"}"}}]}}]} + + data: {"id":"202510291832314ab8147fda644c1b","created":1761733951,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10301,"completion_tokens":131,"total_tokens":10432,"prompt_tokens_details":{"cached_tokens":10232}}} data: [DONE] @@ -142,15 +272,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 671.177667ms + duration: 658.704958ms - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44626 + content_length: 43216 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"content\":\"\\nI'll help you modify the main.go file using the multiedit tool. Let me first read the file to see its current contents.\\n\",\"tool_calls\":[{\"id\":\"call_c0088f90b4c148d686120b52\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_c0088f90b4c148d686120b52\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_013f54c8c7bd47a48b924c06\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_013f54c8c7bd47a48b924c06\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -166,53 +296,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Now"}}]} - - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" I"}}]} + data: {"id":"20251029183233a1c332ff4c2b4bf0","created":1761733954,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"'ll"}}]} + data: {"id":"20251029183233a1c332ff4c2b4bf0","created":1761733954,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" use"}}]} + data: {"id":"20251029183233a1c332ff4c2b4bf0","created":1761733954,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_15d52f9cd823407aa5c3d74b","index":0,"type":"function","function":{"name":"multiedit","arguments":"{\"edits\":[{\"new_string\": \"\\t// Greeting\\n\\tfmt.Println(\\\"Hello, Crush!\\\")\", \"old_string\": \"\\tfmt.Println(\\\"Hello, World!\\\")\"}],\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\"}"}}]}}]} - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" mult"}}]} - - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"ied"}}]} - - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"it"}}]} - - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" to"}}]} - - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" make"}}]} - - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" both"}}]} - - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" changes"}}]} - - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" -"}}]} - - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" add"}}]} - - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} - - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" comment"}}]} - - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" and"}}]} - - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" replace"}}]} - - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} - - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" text"}}]} - - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":":\n"}}]} - - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_de8e2a178ec24099b812f885","index":0,"type":"function","function":{"name":"multiedit","arguments":"{\"edits\":[{\"new_string\": \"\\t// Greeting\\n\\tfmt.Println(\\\"Hello, Crush!\\\")\", \"old_string\": \"\\tfmt.Println(\\\"Hello, World!\\\")\"}],\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\"}"}}]}}]} - - data: {"id":"20251029040947853d0a1342424903","created":1761682188,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10722,"completion_tokens":105,"total_tokens":10827,"prompt_tokens_details":{"cached_tokens":10530}}} + data: {"id":"20251029183233a1c332ff4c2b4bf0","created":1761733954,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10396,"completion_tokens":85,"total_tokens":10481,"prompt_tokens_details":{"cached_tokens":10232}}} data: [DONE] @@ -221,15 +311,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 2.349868208s + duration: 723.418041ms - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45286 + content_length: 43791 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"content\":\"\\nI'll help you modify the main.go file using the multiedit tool. Let me first read the file to see its current contents.\\n\",\"tool_calls\":[{\"id\":\"call_c0088f90b4c148d686120b52\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_c0088f90b4c148d686120b52\",\"role\":\"tool\"},{\"content\":\"\\nNow I'll use multiedit to make both changes - add the comment and replace the text:\\n\",\"tool_calls\":[{\"id\":\"call_de8e2a178ec24099b812f885\",\"function\":{\"arguments\":\"{\\\"edits\\\":[{\\\"new_string\\\": \\\"\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\", \\\"old_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\"}],\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\\\"}\",\"name\":\"multiedit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nApplied 1 edits to file: /tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\\n\\n\",\"tool_call_id\":\"call_de8e2a178ec24099b812f885\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use multiedit to change 'Hello, World!' to 'Hello, Crush!' and add a comment '// Greeting' above the fmt.Println line in main.go\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_013f54c8c7bd47a48b924c06\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_013f54c8c7bd47a48b924c06\",\"role\":\"tool\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_15d52f9cd823407aa5c3d74b\",\"function\":{\"arguments\":\"{\\\"edits\\\":[{\\\"new_string\\\": \\\"\\\\t// Greeting\\\\n\\\\tfmt.Println(\\\\\\\"Hello, Crush!\\\\\\\")\\\", \\\"old_string\\\": \\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\"}],\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\\\"}\",\"name\":\"multiedit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nApplied 1 edits to file: /tmp/crush-test/TestCoderAgent/zai-glm4.6/multiedit_tool/main.go\\n\\n\",\"tool_call_id\":\"call_15d52f9cd823407aa5c3d74b\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -245,81 +335,71 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Done"}}]} - - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"!"}}]} - - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" The"}}]} - - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" file"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Done"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" has"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" been"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Changed"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" updated"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" both"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" changes"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" World"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" -"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"!\""}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" to"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" greeting"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" comment"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" added"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" above"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Crush"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"!\""}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" fmt"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" and"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".Println"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" added"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" line"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" comment"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" and"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" above"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" fmt"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".Println"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" World"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" line"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"!\""}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" in"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" changed"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" to"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":":"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"5"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"-"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Crush"}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"6"}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"!\"."}}]} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} - data: {"id":"20251029040951bc1fa13abfc74be2","created":1761682191,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10868,"completion_tokens":40,"total_tokens":10908,"prompt_tokens_details":{"cached_tokens":10530}}} + data: {"id":"20251029183236cb0da021ed824a87","created":1761733956,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10522,"completion_tokens":35,"total_tokens":10557,"prompt_tokens_details":{"cached_tokens":10480}}} data: [DONE] @@ -328,4 +408,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 716.812584ms + duration: 697.132708ms diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/parallel_tool_calls.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/parallel_tool_calls.yaml index f9873c12b63e6dc50d286a8d27681fd6561617af..0516f180b84d1760d7b86866f5cfa4d62f432f71 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/parallel_tool_calls.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/parallel_tool_calls.yaml @@ -24,19 +24,19 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029040958f304c4f2dfb447a5","created":1761682198,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102918325085e754557ab54389","created":1761733970,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029040958f304c4f2dfb447a5","created":1761682198,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Parallel"}}]} + data: {"id":"2025102918325085e754557ab54389","created":1761733970,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Parallel"}}]} - data: {"id":"20251029040958f304c4f2dfb447a5","created":1761682198,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" glob"}}]} + data: {"id":"2025102918325085e754557ab54389","created":1761733970,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" glob"}}]} - data: {"id":"20251029040958f304c4f2dfb447a5","created":1761682198,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" and"}}]} + data: {"id":"2025102918325085e754557ab54389","created":1761733970,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" and"}}]} - data: {"id":"20251029040958f304c4f2dfb447a5","created":1761682198,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" ls"}}]} + data: {"id":"2025102918325085e754557ab54389","created":1761733970,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" ls"}}]} - data: {"id":"20251029040958f304c4f2dfb447a5","created":1761682198,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" commands"}}]} + data: {"id":"2025102918325085e754557ab54389","created":1761733970,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" commands"}}]} - data: {"id":"20251029040958f304c4f2dfb447a5","created":1761682198,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":149,"completion_tokens":9,"total_tokens":158,"prompt_tokens_details":{"cached_tokens":122}}} + data: {"id":"2025102918325085e754557ab54389","created":1761733970,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":149,"completion_tokens":9,"total_tokens":158,"prompt_tokens_details":{"cached_tokens":122}}} data: [DONE] @@ -45,15 +45,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 698.729459ms + duration: 729.023ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44054 + content_length: 42765 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -69,15 +69,15 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029040958d8bcd134d0094308","created":1761682198,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"202510291832503dd2d843d82042e3","created":1761733970,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"20251029040958d8bcd134d0094308","created":1761682198,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510291832503dd2d843d82042e3","created":1761733970,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029040958d8bcd134d0094308","created":1761682198,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_2bd5ba7c11f948c49d7c06fb","index":0,"type":"function","function":{"name":"glob","arguments":"{\"pattern\":\"**/*.go\"}"}}]}}]} + data: {"id":"202510291832503dd2d843d82042e3","created":1761733970,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_89a95270d84c4281a224021b","index":0,"type":"function","function":{"name":"glob","arguments":"{\"pattern\":\"**/*.go\"}"}}]}}]} - data: {"id":"20251029040958d8bcd134d0094308","created":1761682198,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_50fa8958adb84941851f63bd","index":1,"type":"function","function":{"name":"ls","arguments":"{\"path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls\"}"}}]}}]} + data: {"id":"202510291832503dd2d843d82042e3","created":1761733970,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_ae0a41015c1b46cdaf341a41","index":1,"type":"function","function":{"name":"ls","arguments":"{\"path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls\"}"}}]}}]} - data: {"id":"20251029040958d8bcd134d0094308","created":1761682198,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10594,"completion_tokens":49,"total_tokens":10643,"prompt_tokens_details":{"cached_tokens":10530}}} + data: {"id":"202510291832503dd2d843d82042e3","created":1761733970,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10296,"completion_tokens":49,"total_tokens":10345,"prompt_tokens_details":{"cached_tokens":10232}}} data: [DONE] @@ -86,15 +86,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 659.25575ms + duration: 1.201420458s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44716 + content_length: 43427 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_2bd5ba7c11f948c49d7c06fb\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"**/*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"},{\"id\":\"call_50fa8958adb84941851f63bd\",\"function\":{\"arguments\":\"{\\\"path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls\\\"}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls/main.go\",\"tool_call_id\":\"call_2bd5ba7c11f948c49d7c06fb\",\"role\":\"tool\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_50fa8958adb84941851f63bd\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use glob to find all .go files and use ls to list the current directory, it is very important that you run both tool calls in parallel\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_89a95270d84c4281a224021b\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"**/*.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"},{\"id\":\"call_ae0a41015c1b46cdaf341a41\",\"function\":{\"arguments\":\"{\\\"path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls\\\"}\",\"name\":\"ls\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls/main.go\",\"tool_call_id\":\"call_89a95270d84c4281a224021b\",\"role\":\"tool\"},{\"content\":\"\\n- /tmp/crush-test/TestCoderAgent/zai-glm4.6/parallel_tool_calls/\\n - go.mod\\n - main.go\\n\",\"tool_call_id\":\"call_ae0a41015c1b46cdaf341a41\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -110,87 +110,55 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Found"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Found"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" "}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" "}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"1"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"1"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" file"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" file"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":":"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":":"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" `/"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" `"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"tmp"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"main"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/c"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"rush"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"`."}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"-test"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Directory"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/Test"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" contains"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Coder"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":":"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Agent"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" `"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/z"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"go"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"ai"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".mod"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"-g"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"`"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"lm"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" and"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"4"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" `"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"main"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"6"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/"}}]} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"`."}}]} - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"parallel"}}]} - - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"_tool"}}]} - - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"_calls"}}]} - - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/main"}}]} - - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} - - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"`\n\n"}}]} - - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Directory"}}]} - - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" contains"}}]} - - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":":\n"}}]} - - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"-"}}]} - - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" go"}}]} - - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".mod"}}]} - - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"-"}}]} - - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} - - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} - - data: {"id":"2025102904095930bbb9b7058745a1","created":1761682199,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10704,"completion_tokens":43,"total_tokens":10747,"prompt_tokens_details":{"cached_tokens":10642}}} + data: {"id":"20251029183251fee7a41e998d484d","created":1761733971,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10406,"completion_tokens":27,"total_tokens":10433,"prompt_tokens_details":{"cached_tokens":10232}}} data: [DONE] @@ -199,4 +167,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 643.87875ms + duration: 1.681586916s diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/read_a_file.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/read_a_file.yaml index 7e9adb5a0ad9220eba0d9435cd6cf3f0277b5b51..9c1a0598585c9ac3f27e3d1e5ea5b56cf972b0d9 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/read_a_file.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/read_a_file.yaml @@ -6,9 +6,9 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 43927 + content_length: 42638 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -24,13 +24,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"2025102904084799695894033d49e8","created":1761682128,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"202510291831298b4c265ff696451d","created":1761733889,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"2025102904084799695894033d49e8","created":1761682128,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510291831298b4c265ff696451d","created":1761733889,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"2025102904084799695894033d49e8","created":1761682128,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_3f18ac5bff5447d5a6430868","index":0,"type":"function","function":{"name":"glob","arguments":"{\"pattern\":\"go.mod\"}"}}]}}]} + data: {"id":"202510291831298b4c265ff696451d","created":1761733889,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_5c9fe14b5d0c48be8abcb4d2","index":0,"type":"function","function":{"name":"view","arguments":"{\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file/go.mod\"}"}}]}}]} - data: {"id":"2025102904084799695894033d49e8","created":1761682128,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10568,"completion_tokens":18,"total_tokens":10586,"prompt_tokens_details":{"cached_tokens":10530}}} + data: {"id":"202510291831298b4c265ff696451d","created":1761733889,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10270,"completion_tokens":36,"total_tokens":10306,"prompt_tokens_details":{"cached_tokens":45}}} data: [DONE] @@ -39,7 +39,7 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 864.688959ms + duration: 1.706086417s - id: 1 request: proto: HTTP/1.1 @@ -63,15 +63,15 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029040847b231db3b61a04894","created":1761682127,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510291831283eee0561154d4b20","created":1761733888,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029040847b231db3b61a04894","created":1761682127,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Go"}}]} + data: {"id":"202510291831283eee0561154d4b20","created":1761733888,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Go"}}]} - data: {"id":"20251029040847b231db3b61a04894","created":1761682127,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" mod"}}]} + data: {"id":"202510291831283eee0561154d4b20","created":1761733888,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Mod"}}]} - data: {"id":"20251029040847b231db3b61a04894","created":1761682127,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" title"}}]} + data: {"id":"202510291831283eee0561154d4b20","created":1761733888,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Reading"}}]} - data: {"id":"20251029040847b231db3b61a04894","created":1761682127,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":124,"completion_tokens":7,"total_tokens":131,"prompt_tokens_details":{"cached_tokens":4}}} + data: {"id":"202510291831283eee0561154d4b20","created":1761733888,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":124,"completion_tokens":7,"total_tokens":131,"prompt_tokens_details":{"cached_tokens":114}}} data: [DONE] @@ -80,15 +80,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 755.961083ms + duration: 33.427888875s - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44237 + content_length: 43025 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_3f18ac5bff5447d5a6430868\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"go.mod\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file/go.mod\",\"tool_call_id\":\"call_3f18ac5bff5447d5a6430868\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_5c9fe14b5d0c48be8abcb4d2\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file/go.mod\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"call_5c9fe14b5d0c48be8abcb4d2\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -104,80 +104,33 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510290408497bf0c64cdcdd42d2","created":1761682129,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"20251029183202ad7554f683e04cca","created":1761733922,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"202510290408497bf0c64cdcdd42d2","created":1761682129,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251029183202ad7554f683e04cca","created":1761733922,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510290408497bf0c64cdcdd42d2","created":1761682129,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_00fb3d0d9ba246b18341366f","index":0,"type":"function","function":{"name":"view","arguments":"{\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file/go.mod\"}"}}]}}]} + data: {"id":"20251029183202ad7554f683e04cca","created":1761733922,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"module"}}]} - data: {"id":"202510290408497bf0c64cdcdd42d2","created":1761682129,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10611,"completion_tokens":36,"total_tokens":10647,"prompt_tokens_details":{"cached_tokens":45}}} + data: {"id":"20251029183202ad7554f683e04cca","created":1761733922,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" example"}}]} - data: [DONE] - - headers: - Content-Type: - - text/event-stream;charset=UTF-8 - status: 200 OK - code: 200 - duration: 30.648441959s -- id: 3 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 44624 - host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Read the go mod\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_3f18ac5bff5447d5a6430868\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"go.mod\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file/go.mod\",\"tool_call_id\":\"call_3f18ac5bff5447d5a6430868\",\"role\":\"tool\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_00fb3d0d9ba246b18341366f\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/read_a_file/go.mod\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|module example.com/testproject\\n 2|\\n 3|go 1.23\\n\\n\",\"tool_call_id\":\"call_00fb3d0d9ba246b18341366f\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://api.z.ai/api/coding/paas/v4/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"202510290409204b257a322bef4713","created":1761682160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - - data: {"id":"202510290409204b257a322bef4713","created":1761682160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"202510290409204b257a322bef4713","created":1761682160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"``"}}]} - - data: {"id":"202510290409204b257a322bef4713","created":1761682160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"`\n"}}]} - - data: {"id":"202510290409204b257a322bef4713","created":1761682160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"module"}}]} - - data: {"id":"202510290409204b257a322bef4713","created":1761682160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" example"}}]} - - data: {"id":"202510290409204b257a322bef4713","created":1761682160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".com"}}]} - - data: {"id":"202510290409204b257a322bef4713","created":1761682160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/test"}}]} - - data: {"id":"202510290409204b257a322bef4713","created":1761682160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"project"}}]} + data: {"id":"20251029183202ad7554f683e04cca","created":1761733922,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".com"}}]} - data: {"id":"202510290409204b257a322bef4713","created":1761682160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n\n"}}]} + data: {"id":"20251029183202ad7554f683e04cca","created":1761733922,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"/test"}}]} - data: {"id":"202510290409204b257a322bef4713","created":1761682160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"go"}}]} + data: {"id":"20251029183202ad7554f683e04cca","created":1761733922,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"project"}}]} - data: {"id":"202510290409204b257a322bef4713","created":1761682160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" "}}]} + data: {"id":"20251029183202ad7554f683e04cca","created":1761733922,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n\n"}}]} - data: {"id":"202510290409204b257a322bef4713","created":1761682160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"1"}}]} + data: {"id":"20251029183202ad7554f683e04cca","created":1761733922,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"go"}}]} - data: {"id":"202510290409204b257a322bef4713","created":1761682160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} + data: {"id":"20251029183202ad7554f683e04cca","created":1761733922,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" "}}]} - data: {"id":"202510290409204b257a322bef4713","created":1761682160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"23"}}]} + data: {"id":"20251029183202ad7554f683e04cca","created":1761733922,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"1"}}]} - data: {"id":"202510290409204b257a322bef4713","created":1761682160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251029183202ad7554f683e04cca","created":1761733922,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} - data: {"id":"202510290409204b257a322bef4713","created":1761682160,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"```"}}]} + data: {"id":"20251029183202ad7554f683e04cca","created":1761733922,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"23"}}]} - data: {"id":"202510290409204b257a322bef4713","created":1761682160,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10682,"completion_tokens":20,"total_tokens":10702,"prompt_tokens_details":{"cached_tokens":10585}}} + data: {"id":"20251029183202ad7554f683e04cca","created":1761733922,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10341,"completion_tokens":16,"total_tokens":10357,"prompt_tokens_details":{"cached_tokens":45}}} data: [DONE] @@ -186,4 +139,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 906.664333ms + duration: 1.145293959s diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/simple_test.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/simple_test.yaml index 89312a5a1f44e932592c3a52547dbb8effafe56c..db31208a3bbdf00a6a36ceafb8e94b22543bac6b 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/simple_test.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/simple_test.yaml @@ -24,11 +24,11 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029040845da47b998896542f4","created":1761682125,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102918312703ad574c829a4b77","created":1761733887,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029040845da47b998896542f4","created":1761682125,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]} + data: {"id":"2025102918312703ad574c829a4b77","created":1761733887,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]} - data: {"id":"20251029040845da47b998896542f4","created":1761682125,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":121,"completion_tokens":5,"total_tokens":126,"prompt_tokens_details":{"cached_tokens":114}}} + data: {"id":"2025102918312703ad574c829a4b77","created":1761733887,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":121,"completion_tokens":5,"total_tokens":126,"prompt_tokens_details":{"cached_tokens":114}}} data: [DONE] @@ -37,15 +37,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 2.278464958s + duration: 2.761298541s - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 43917 + content_length: 42628 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/simple_test\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Hello\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/simple_test\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"Hello\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -61,139 +61,29 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"2025102918312741751065f16040a7","created":1761733887,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"The"}}]} + data: {"id":"2025102918312741751065f16040a7","created":1761733887,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" user"}}]} + data: {"id":"2025102918312741751065f16040a7","created":1761733887,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]} - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" just"}}]} + data: {"id":"2025102918312741751065f16040a7","created":1761733887,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"!"}}]} - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" said"}}]} + data: {"id":"2025102918312741751065f16040a7","created":1761733887,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" How"}}]} - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" \""}}]} + data: {"id":"2025102918312741751065f16040a7","created":1761733887,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" can"}}]} - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"Hello"}}]} + data: {"id":"2025102918312741751065f16040a7","created":1761733887,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" I"}}]} - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"\"."}}]} + data: {"id":"2025102918312741751065f16040a7","created":1761733887,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" help"}}]} - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" This"}}]} + data: {"id":"2025102918312741751065f16040a7","created":1761733887,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" you"}}]} - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" is"}}]} + data: {"id":"2025102918312741751065f16040a7","created":1761733887,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" today"}}]} - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" a"}}]} + data: {"id":"2025102918312741751065f16040a7","created":1761733887,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"?"}}]} - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" simple"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" greeting"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" According"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" my"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" communication"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" style"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" guidelines"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" should"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" keep"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" responses"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" minimal"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" and"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" one"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-word"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" answers"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" when"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" possible"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Since"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" this"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" is"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" just"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" a"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" greeting"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" should"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" respond"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" with"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" a"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" simple"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" \""}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"Hello"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"\""}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" back"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".\n\n"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"I"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" don"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"'t"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" need"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" any"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" tools"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" for"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" this"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" response"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]} - - data: {"id":"20251029040846371b301f97c04e6d","created":1761682126,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10564,"completion_tokens":69,"total_tokens":10633,"prompt_tokens_details":{"cached_tokens":45}}} + data: {"id":"2025102918312741751065f16040a7","created":1761733887,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10266,"completion_tokens":14,"total_tokens":10280,"prompt_tokens_details":{"cached_tokens":45}}} data: [DONE] @@ -202,4 +92,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 3.137078125s + duration: 3.244215459s diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/sourcegraph_tool.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/sourcegraph_tool.yaml index f488d9706fd475c1c38adc2af2f6677c0cd3686a..1a249438ffb947f95c22c04eefb14814872329fa 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/sourcegraph_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/sourcegraph_tool.yaml @@ -24,21 +24,25 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510290409524ac5def0af464bc4","created":1761682193,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102918323949ec5611c10948cf","created":1761733959,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510290409524ac5def0af464bc4","created":1761682193,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Searching"}}]} + data: {"id":"2025102918323949ec5611c10948cf","created":1761733959,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Search"}}]} - data: {"id":"202510290409524ac5def0af464bc4","created":1761682193,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} + data: {"id":"2025102918323949ec5611c10948cf","created":1761733959,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" for"}}]} - data: {"id":"202510290409524ac5def0af464bc4","created":1761682193,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" code"}}]} + data: {"id":"2025102918323949ec5611c10948cf","created":1761733959,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} - data: {"id":"202510290409524ac5def0af464bc4","created":1761682193,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} + data: {"id":"2025102918323949ec5611c10948cf","created":1761733959,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} - data: {"id":"202510290409524ac5def0af464bc4","created":1761682193,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Source"}}]} + data: {"id":"2025102918323949ec5611c10948cf","created":1761733959,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" functions"}}]} - data: {"id":"202510290409524ac5def0af464bc4","created":1761682193,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"graph"}}]} + data: {"id":"2025102918323949ec5611c10948cf","created":1761733959,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} - data: {"id":"202510290409524ac5def0af464bc4","created":1761682193,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":133,"completion_tokens":10,"total_tokens":143,"prompt_tokens_details":{"cached_tokens":4}}} + data: {"id":"2025102918323949ec5611c10948cf","created":1761733959,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" Source"}}]} + + data: {"id":"2025102918323949ec5611c10948cf","created":1761733959,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"graph"}}]} + + data: {"id":"2025102918323949ec5611c10948cf","created":1761733959,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":133,"completion_tokens":12,"total_tokens":145,"prompt_tokens_details":{"cached_tokens":4}}} data: [DONE] @@ -47,15 +51,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 651.244208ms + duration: 648.542458ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 43977 + content_length: 42688 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -71,13 +75,271 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510290409539ac1d08ead8f4ade","created":1761682193,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"The"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" user"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" wants"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" me"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Source"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"graph"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" search"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" for"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" '"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"func"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"'"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" in"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Go"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" repositories"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" need"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" source"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"graph"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" tool"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" with"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" appropriate"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" query"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".\n\n"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"Looking"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" at"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" source"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"graph"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" tool"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" documentation"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":":\n"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" should"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" provide"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" a"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" search"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" query"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" using"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Source"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"graph"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" syntax"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" can"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" filters"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" like"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" '"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"lang"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":":"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"go"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"'"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" limit"}}]} - data: {"id":"202510290409539ac1d08ead8f4ade","created":1761682193,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - data: {"id":"202510290409539ac1d08ead8f4ade","created":1761682193,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_d1922ceddb1049418e926ab0","index":0,"type":"function","function":{"name":"sourcegraph","arguments":"{\"query\":\"lang:go func main\"}"}}]}}]} + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Go"}}]} - data: {"id":"202510290409539ac1d08ead8f4ade","created":1761682193,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10577,"completion_tokens":22,"total_tokens":10599,"prompt_tokens_details":{"cached_tokens":10530}}} + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" code"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" can"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" use"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" default"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" count"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" ("}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"10"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":")"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" and"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" timeout"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" settings"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n\n"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"The"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" query"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" should"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" be"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":":\n"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" `\""}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"func"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"\"`"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" -"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" exact"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" phrase"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" matching"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" for"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" function"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" signature"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"-"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" `"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"lang"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":":"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"go"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"`"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" -"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" limit"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Go"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" files"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n\n"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"So"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" full"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" query"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" would"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" be"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":":"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" `\""}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"func"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"\""}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" lang"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":":"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"go"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"`"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_ea1945ebb1fc448191ecc6e0","index":0,"type":"function","function":{"name":"sourcegraph","arguments":"{\"query\":\"\\\"func main\\\" lang:go\"}"}}]}}]} + + data: {"id":"202510291832396a457400fe0247de","created":1761733959,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10279,"completion_tokens":153,"total_tokens":10432,"prompt_tokens_details":{"cached_tokens":10232}}} data: [DONE] @@ -86,15 +348,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 730.182792ms + duration: 737.791ms - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 424 + content_length: 428 host: sourcegraph.com - body: '{"query":"query Search($query: String!) { search(query: $query, version: V2, patternType: keyword ) { results { matchCount, limitHit, resultCount, approximateResultCount, missing { name }, timedout { name }, indexUnavailable, results { __typename, ... on FileMatch { repository { name }, file { path, url, content }, lineMatches { preview, lineNumber, offsetAndLengths } } } } } }","variables":{"query":"lang:go func main"}}' + body: '{"query":"query Search($query: String!) { search(query: $query, version: V2, patternType: keyword ) { results { matchCount, limitHit, resultCount, approximateResultCount, missing { name }, timedout { name }, indexUnavailable, results { __typename, ... on FileMatch { repository { name }, file { path, url, content }, lineMatches { preview, lineNumber, offsetAndLengths } } } } } }","variables":{"query":"\"func main\" lang:go"}}' headers: Content-Type: - application/json @@ -108,21 +370,21 @@ interactions: proto_minor: 0 content_length: -1 uncompressed: true - body: '{"data":{"search":{"results":{"matchCount":30,"limitHit":true,"resultCount":30,"approximateResultCount":"30+","missing":[],"timedout":[],"indexUnavailable":false,"results":[{"__typename":"FileMatch","repository":{"name":"github.com/GoesToEleven/GolangTraining"},"file":{"path":"14_functions/10_func-expression/01_before-func-expression/main.go","url":"/github.com/GoesToEleven/GolangTraining/-/blob/14_functions/10_func-expression/01_before-func-expression/main.go","content":"package main\n\nimport \"fmt\"\n\nfunc greeting() {\n\tfmt.Println(\"Hello world!\")\n}\n\nfunc main() {\n\tgreeting()\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":8,"offsetAndLengths":[[0,9]]},{"preview":"package main","lineNumber":0,"offsetAndLengths":[[8,4]]},{"preview":"func greeting() {","lineNumber":4,"offsetAndLengths":[[0,4]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/GoesToEleven/GolangTraining"},"file":{"path":"14_functions/10_func-expression/02_func-expression/main.go","url":"/github.com/GoesToEleven/GolangTraining/-/blob/14_functions/10_func-expression/02_func-expression/main.go","content":"package main\n\nimport \"fmt\"\n\nfunc main() {\n\n\tgreeting := func() {\n\t\tfmt.Println(\"Hello world!\")\n\t}\n\n\tgreeting()\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":4,"offsetAndLengths":[[0,9]]},{"preview":"\tgreeting := func() {","lineNumber":6,"offsetAndLengths":[[13,4]]},{"preview":"package main","lineNumber":0,"offsetAndLengths":[[8,4]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/jcalabro/uscope"},"file":{"path":"assets/gobacktrace/main.go","url":"/github.com/jcalabro/uscope/-/blob/assets/gobacktrace/main.go","content":"package main\n\nimport \"fmt\"\n\nfunc FuncE() {\n\tfmt.Println(\"FuncE\")\n}\n\nfunc FuncD() {\n\tFuncE()\n\tfmt.Println(\"FuncD\")\n}\n\nfunc FuncC() {\n\tFuncD()\n\tfmt.Println(\"FuncC\")\n}\n\nfunc FuncB() {\n\tFuncC()\n\tfmt.Println(\"FuncB\")\n}\n\nfunc FuncA() {\n\tFuncB()\n\tfmt.Println(\"FuncA\")\n}\n\nfunc FuncF() {\n\tfmt.Println(\"FuncF\")\n\tFuncE()\n}\n\nfunc main() {\n\tFuncA()\n\tFuncB()\n\tFuncC()\n\tFuncD()\n\tFuncE()\n\tFuncF()\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":33,"offsetAndLengths":[[0,9]]},{"preview":"\tFuncA()","lineNumber":34,"offsetAndLengths":[[1,4]]},{"preview":"\tFuncB()","lineNumber":35,"offsetAndLengths":[[1,4]]},{"preview":"\tFuncC()","lineNumber":36,"offsetAndLengths":[[1,4]]},{"preview":"\tFuncD()","lineNumber":37,"offsetAndLengths":[[1,4]]},{"preview":"\tFuncE()","lineNumber":38,"offsetAndLengths":[[1,4]]},{"preview":"\tFuncF()","lineNumber":39,"offsetAndLengths":[[1,4]]},{"preview":"func FuncE() {","lineNumber":4,"offsetAndLengths":[[0,4],[5,4]]},{"preview":"\tfmt.Println(\"FuncE\")","lineNumber":5,"offsetAndLengths":[[14,4]]},{"preview":"func FuncD() {","lineNumber":8,"offsetAndLengths":[[0,4],[5,4]]},{"preview":"\tFuncE()","lineNumber":9,"offsetAndLengths":[[1,4]]},{"preview":"\tfmt.Println(\"FuncD\")","lineNumber":10,"offsetAndLengths":[[14,4]]},{"preview":"func FuncC() {","lineNumber":13,"offsetAndLengths":[[0,4],[5,4]]},{"preview":"\tFuncD()","lineNumber":14,"offsetAndLengths":[[1,4]]},{"preview":"\tfmt.Println(\"FuncC\")","lineNumber":15,"offsetAndLengths":[[14,4]]},{"preview":"func FuncB() {","lineNumber":18,"offsetAndLengths":[[0,4],[5,4]]},{"preview":"\tFuncC()","lineNumber":19,"offsetAndLengths":[[1,4]]},{"preview":"\tfmt.Println(\"FuncB\")","lineNumber":20,"offsetAndLengths":[[14,4]]},{"preview":"func FuncA() {","lineNumber":23,"offsetAndLengths":[[0,4],[5,4]]}]}]}}}}' + body: '{"data":{"search":{"results":{"matchCount":30,"limitHit":true,"resultCount":30,"approximateResultCount":"30+","missing":[],"timedout":[],"indexUnavailable":false,"results":[{"__typename":"FileMatch","repository":{"name":"github.com/wx-chevalier/Go-Notes"},"file":{"path":"99~参考资料/2017~A Huge Number of Go Examples/codes/first/first/main.go","url":"/github.com/wx-chevalier/Go-Notes/-/blob/99~%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99/2017~A%20Huge%20Number%20of%20Go%20Examples/codes/first/first/main.go","content":"\n// package main is a special package\n// it allows Go to create an executable file\npackage main\n\n/*\nThis is a multi-line comment.\n\nimport keyword makes another package available\n for this .go \"file\".\n\nimport \"fmt\" lets you access fmt package''s functionality\n here in this file.\n*/\nimport \"fmt\"\n\n// \"func main\" is special.\n//\n// Go has to know where to start\n//\n// func main creates a starting point for Go\n//\n// After compiling the code,\n// Go runtime will first run this function\nfunc main() {\n\t// after: import \"fmt\"\n\t// Println function of \"fmt\" package becomes available\n\n\t// Look at what it looks like by typing in the console:\n\t// godoc -src fmt Println\n\n\t// Println is just an exported function from\n\t// \"fmt\" package\n\n\t// Exported = First Letter is uppercase\n\tfmt.Println(\"Hello Gopher!\")\n\n\t// Go cannot call Println function by itself.\n\t// That''s why you need to call it here.\n\t// It only calls `func main` automatically.\n\n\t// -----\n\n\t// Go supports Unicode characters in string literals\n\t// And also in source-code: KÖSTEBEK!\n\n\t// EXERCISE: Remove the comments from below --\u003e //\n\t// fmt.Println(\"Merhaba Köstebek!\")\n\n\t// Unnecessary note:\n\t// \"Merhaba Köstebek\" means \"Hello Gopher\"\n\t// in Turkish language\n}\n"},"lineMatches":[{"preview":"// \"func main\" is special.","lineNumber":16,"offsetAndLengths":[[3,11]]},{"preview":"func main() {","lineNumber":24,"offsetAndLengths":[[0,9]]},{"preview":"// func main creates a starting point for Go","lineNumber":20,"offsetAndLengths":[[3,9]]},{"preview":"\t// It only calls `func main` automatically.","lineNumber":39,"offsetAndLengths":[[19,9]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/wx-chevalier/Go-Notes"},"file":{"path":"99~参考资料/2017~A Huge Number of Go Examples/codes/02-write-your-first-program/main.go","url":"/github.com/wx-chevalier/Go-Notes/-/blob/99~%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99/2017~A%20Huge%20Number%20of%20Go%20Examples/codes/02-write-your-first-program/main.go","content":"\n// package main is a special package\n// it allows Go to create an executable file\npackage main\n\n/*\nThis is a multi-line comment.\n\nimport keyword makes another package available\n for this .go \"file\".\n\nimport \"fmt\" lets you access fmt package''s functionality\n here in this file.\n*/\nimport \"fmt\"\n\n// \"func main\" is special.\n//\n// Go has to know where to start\n//\n// func main creates a starting point for Go\n//\n// After compiling the code,\n// Go runtime will first run this function\nfunc main() {\n\t// after: import \"fmt\"\n\t// Println function of \"fmt\" package becomes available\n\n\t// Look at what it looks like by typing in the console:\n\t// go doc -src fmt Println\n\n\t// Println is just an exported function from\n\t// \"fmt\" package\n\n\t// Exported = First Letter is uppercase\n\tfmt.Println(\"Hello Gopher!\")\n\n\t// Go cannot call Println function by itself.\n\t// That''s why you need to call it here.\n\t// It only calls `func main` automatically.\n\n\t// -----\n\n\t// Go supports Unicode characters in string literals\n\t// And also in source-code: KÖSTEBEK!\n\t//\n\t// Because: Literal ~= Source Code\n\n\t// EXERCISE: Remove the comments from below --\u003e //\n\t// fmt.Println(\"Merhaba Köstebek!\")\n\n\t// Unnecessary note:\n\t// \"Merhaba Köstebek\" means \"Hello Gopher\"\n\t// in Turkish language\n}\n"},"lineMatches":[{"preview":"// \"func main\" is special.","lineNumber":16,"offsetAndLengths":[[3,11]]},{"preview":"func main() {","lineNumber":24,"offsetAndLengths":[[0,9]]},{"preview":"// func main creates a starting point for Go","lineNumber":20,"offsetAndLengths":[[3,9]]},{"preview":"\t// It only calls `func main` automatically.","lineNumber":39,"offsetAndLengths":[[19,9]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/wx-chevalier/Go-Notes"},"file":{"path":"99~参考资料/2018~《Learn Go》/translation/chinese/02-编写第一个程序/main.go","url":"/github.com/wx-chevalier/Go-Notes/-/blob/99~%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99/2018~%E3%80%8ALearn%20Go%E3%80%8B/translation/chinese/02-%E7%BC%96%E5%86%99%E7%AC%AC%E4%B8%80%E4%B8%AA%E7%A8%8B%E5%BA%8F/main.go","content":"// Copyright © 2018 Inanc Gumus\n// Learn Go Programming Course\n// License: https://creativecommons.org/licenses/by-nc-sa/4.0/\n//\n// For more tutorials : https://learngoprogramming.com\n// In-person training : https://www.linkedin.com/in/inancgumus/\n// Follow me on twitter: https://twitter.com/inancgumus\n\n// package main 是一个特殊的包\n// 它允许 Go 创建一个可执行文件\npackage main\n\n/*\n这是一个多行注释\n\nimport 关键字引入另一个包\n 对于这个 .go ”文件“\n\nimport \"fmt\" 允许你使用 fmt 包的各种函数\n 在这个文件\n*/\nimport \"fmt\"\n\n// \"func main\" 是特殊的\n//\n// Go 必须知道从哪里开始执行\n//\n// func main 对于 Go 而言就是开始执行的位置\n//\n// 代码编译后,\n// Go runtime 第一个执行该函数\nfunc main() {\n\t// import \"fmt\" 之后\n\t// \"fmt\" 包中的 Println 函数就可以使用\n\n\t// 在控制台输入下面的命令可以查看它的源代码:\n\t// go doc -src fmt Println\n\n\t// Println 是一个 exported 函数来自\n\t// \"fmt\" 包\n\n\t// Exported = 首字母大写\n\tfmt.Println(\"Hello Gopher!\")\n\n\t// Go 本身不能调用 Println 函数\n\t// 这就是为什么你需要在这里调用它\n\t// Go 只能自动地调用 `func main`\n\n\t// -----\n\n\t// Go 字符串支持 Unicode 字符\n\t// 源代码同时也支持: KÖSTEBEK!\n\t//\n\t// 因为: 字面值 ~= 源代码\n\n\t// 练习: 删除下行注释的 --\u003e //\n\t// fmt.Println(\"Merhaba Köstebek!\")\n\n\t// 不重要的注释:\n\t// \"Merhaba Köstebek\" 的意思是 \"你好 Gopher\"\n\t// 在土耳其语\n}\n"},"lineMatches":[{"preview":"// \"func main\" 是特殊的","lineNumber":23,"offsetAndLengths":[[3,11]]},{"preview":"func main() {","lineNumber":31,"offsetAndLengths":[[0,9]]},{"preview":"\t// Go 只能自动地调用 `func main`","lineNumber":46,"offsetAndLengths":[[16,9]]},{"preview":"// func main 对于 Go 而言就是开始执行的位置","lineNumber":27,"offsetAndLengths":[[3,9]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/wx-chevalier/Go-Notes"},"file":{"path":"99~参考资料/2018~《Learn Go》/first/first/main.go","url":"/github.com/wx-chevalier/Go-Notes/-/blob/99~%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99/2018~%E3%80%8ALearn%20Go%E3%80%8B/first/first/main.go","content":"// Copyright © 2018 Inanc Gumus\n// Learn Go Programming Course\n// License: https://creativecommons.org/licenses/by-nc-sa/4.0/\n//\n// For more tutorials : https://learngoprogramming.com\n// In-person training : https://www.linkedin.com/in/inancgumus/\n// Follow me on twitter: https://twitter.com/inancgumus\n\n// package main is a special package\n// it allows Go to create an executable file\npackage main\n\n/*\nThis is a multi-line comment.\n\nimport keyword makes another package available\n for this .go \"file\".\n\nimport \"fmt\" lets you access fmt package''s functionality\n here in this file.\n*/\nimport \"fmt\"\n\n// \"func main\" is special.\n//\n// Go has to know where to start\n//\n// func main creates a starting point for Go\n//\n// After compiling the code,\n// Go runtime will first run this function\nfunc main() {\n\t// after: import \"fmt\"\n\t// Println function of \"fmt\" package becomes available\n\n\t// Look at what it looks like by typing in the console:\n\t// go doc -src fmt Println\n\n\t// Println is just an exported function from\n\t// \"fmt\" package\n\n\t// Exported = First Letter is uppercase\n\tfmt.Println(\"Hello Gopher!\")\n\n\t// Go cannot call Println function by itself.\n\t// That''s why you need to call it here.\n\t// It only calls `func main` automatically.\n\n\t// -----\n\n\t// Go supports Unicode characters in string literals\n\t// And also in source-code: KÖSTEBEK!\n\n\t// EXERCISE: Remove the comments from below --\u003e //\n\t// fmt.Println(\"Merhaba Köstebek!\")\n\n\t// Unnecessary note:\n\t// \"Merhaba Köstebek\" means \"Hello Gopher\"\n\t// in Turkish language\n}\n"},"lineMatches":[{"preview":"// \"func main\" is special.","lineNumber":23,"offsetAndLengths":[[3,11]]},{"preview":"func main() {","lineNumber":31,"offsetAndLengths":[[0,9]]},{"preview":"// func main creates a starting point for Go","lineNumber":27,"offsetAndLengths":[[3,9]]},{"preview":"\t// It only calls `func main` automatically.","lineNumber":46,"offsetAndLengths":[[19,9]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/wx-chevalier/Go-Notes"},"file":{"path":"99~参考资料/2018~《Learn Go》/translation/spanish/02-tu-primer-programa/main.go","url":"/github.com/wx-chevalier/Go-Notes/-/blob/99~%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99/2018~%E3%80%8ALearn%20Go%E3%80%8B/translation/spanish/02-tu-primer-programa/main.go","content":"// Copyright © 2021 Inanc Gumus\n// Learn Go Programming Course\n// Licencia: https://creativecommons.org/licenses/by-nc-sa/4.0/\n//\n// Para mas tutoriales: https://learngoprogramming.com\n// Clases particulares: https://www.linkedin.com/in/inancgumus/\n// Sigueme en twitter: https://twitter.com/inancgumus\n\n// package main es un paquete especial\n// le permite a Go crear un archivo ejecutable\npackage main\n\n/*\nEsto es un comentario multilinea.\n\nla palabra import hace que otro paquete este disponible\n para este \"archivo\" .go.\n\nimport \"fmt\" te permite acceder a la funcionaliddad del paquete fmt\n en este archivo.\n*/\nimport \"fmt\"\n\n// \"func main\" es especial.\n//\n// Go tiene que saber por donde empezar\n//\n// func main crea un punto de inicio para Go\n//\n// Después de compilar el codigo,\n// Go ejecutará esta función primero.\nfunc main() {\n\t// después del: import \"fmt\"\n\t// La función Println del paquete \"fmt\" estará disponible\n\n\t// Lee sobre ella escribiendo los siguiente en la consola:\n\t// go doc -src fmt Println\n\n\t// Println es simplemente una función exportada de:\n\t// \"fmt\" package\n\n\t// Para poder exportar una función tendrás que escribir el\n\t// primer caracter del nombre de la función en mayúscula.\n\tfmt.Println(\"Hello Gopher!\")\n\n\t// Go no puede llamar a la función Println por si mismo.\n\t// Por eso la tienes que llamar aqui.\n\t// Solo llama a la `func main` de forma automatica.\n\n\t// -----\n\n\t// Go soporta caracteres unicode en cadenas de texto literal\n\t// y tambien en el codigo fuente: KÖSTEBEK!\n\t//\n\t// Porque: Literal ~= Codigo Fuente\n}\n"},"lineMatches":[{"preview":"// \"func main\" es especial.","lineNumber":23,"offsetAndLengths":[[3,11]]},{"preview":"func main() {","lineNumber":31,"offsetAndLengths":[[0,9]]},{"preview":"// func main crea un punto de inicio para Go","lineNumber":27,"offsetAndLengths":[[3,9]]},{"preview":"\t// Solo llama a la `func main` de forma automatica.","lineNumber":47,"offsetAndLengths":[[21,9]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/wx-chevalier/Go-Notes"},"file":{"path":"99~参考资料/2018~《Learn Go》/02-write-your-first-program/main.go","url":"/github.com/wx-chevalier/Go-Notes/-/blob/99~%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99/2018~%E3%80%8ALearn%20Go%E3%80%8B/02-write-your-first-program/main.go","content":"// Copyright © 2018 Inanc Gumus\n// Learn Go Programming Course\n// License: https://creativecommons.org/licenses/by-nc-sa/4.0/\n//\n// For more tutorials : https://learngoprogramming.com\n// In-person training : https://www.linkedin.com/in/inancgumus/\n// Follow me on twitter: https://twitter.com/inancgumus\n\n// package main is a special package\n// it allows Go to create an executable file\npackage main\n\n/*\nThis is a multi-line comment.\n\nimport keyword makes another package available\n for this .go \"file\".\n\nimport \"fmt\" lets you access fmt package''s functionality\n here in this file.\n*/\nimport \"fmt\"\n\n// \"func main\" is special.\n//\n// Go has to know where to start\n//\n// func main creates a starting point for Go\n//\n// After compiling the code,\n// Go runtime will first run this function\nfunc main() {\n\t// after: import \"fmt\"\n\t// Println function of \"fmt\" package becomes available\n\n\t// Look at what it looks like by typing in the console:\n\t// go doc -src fmt Println\n\n\t// Println is just an exported function from\n\t// \"fmt\" package\n\n\t// Exported = First Letter is uppercase\n\tfmt.Println(\"Hello Gopher!\")\n\n\t// Go cannot call Println function by itself.\n\t// That''s why you need to call it here.\n\t// It only calls `func main` automatically.\n\n\t// -----\n\n\t// Go supports Unicode characters in string literals\n\t// And also in source-code: KÖSTEBEK!\n\t//\n\t// Because: Literal ~= Source Code\n\n\t// EXERCISE: Remove the comments from below --\u003e //\n\t// fmt.Println(\"Merhaba Köstebek!\")\n\n\t// Unnecessary note:\n\t// \"Merhaba Köstebek\" means \"Hello Gopher\"\n\t// in Turkish language\n}\n"},"lineMatches":[{"preview":"// \"func main\" is special.","lineNumber":23,"offsetAndLengths":[[3,11]]},{"preview":"func main() {","lineNumber":31,"offsetAndLengths":[[0,9]]},{"preview":"// func main creates a starting point for Go","lineNumber":27,"offsetAndLengths":[[3,9]]},{"preview":"\t// It only calls `func main` automatically.","lineNumber":46,"offsetAndLengths":[[19,9]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/Go-Learning-Land/Go-Learning-Archive"},"file":{"path":"GolangBasics/learngo/translation/spanish/02-tu-primer-programa/main.go","url":"/github.com/Go-Learning-Land/Go-Learning-Archive/-/blob/GolangBasics/learngo/translation/spanish/02-tu-primer-programa/main.go","content":"// Copyright © 2021 Inanc Gumus\n// Learn Go Programming Course\n// Licencia: https://creativecommons.org/licenses/by-nc-sa/4.0/\n//\n// Para mas tutoriales: https://learngoprogramming.com\n// Clases particulares: https://www.linkedin.com/in/inancgumus/\n// Sigueme en twitter: https://twitter.com/inancgumus\n\n// package main es un paquete especial\n// le permite a Go crear un archivo ejecutable\npackage main\n\n/*\nEsto es un comentario multilinea.\n\nla palabra import hace que otro paquete este disponible\n para este \"archivo\" .go.\n\nimport \"fmt\" te permite acceder a la funcionaliddad del paquete fmt\n en este archivo.\n*/\nimport \"fmt\"\n\n// \"func main\" es especial.\n//\n// Go tiene que saber por donde empezar\n//\n// func main crea un punto de inicio para Go\n//\n// Despues de compilar el codigo,\n// Go ejecutara esta funcion primero.\nfunc main() {\n\t// despues del: import \"fmt\"\n\t// La funcion Println del paquete \"fmt\" estara disponible\n\n\t// Lee sobre ella escribiendo los siguiente en la consola:\n\t// go doc -src fmt Println\n\n\t// Println es simplemente una funcion exportada de:\n\t// \"fmt\" package\n\n\t// Exportada = Primera letra en mayuscula\n\tfmt.Println(\"Hello Gopher!\")\n\n\t// Go no puede llamar a la funcion Println por si mismo.\n\t// Por eso la tienes que llamar aqui.\n\t// Solo llama a la `func main` de forma automatica.\n\n\t// -----\n\n\t// Go soporta caracteres unicode en cadenas de texto literal\n\t// y tambien en el codigo fuente: KÖSTEBEK!\n\t//\n\t// Porque: Literal ~= Codigo Fuente\n}\n"},"lineMatches":[{"preview":"// \"func main\" es especial.","lineNumber":23,"offsetAndLengths":[[3,11]]},{"preview":"func main() {","lineNumber":31,"offsetAndLengths":[[0,9]]},{"preview":"// func main crea un punto de inicio para Go","lineNumber":27,"offsetAndLengths":[[3,9]]},{"preview":"\t// Solo llama a la `func main` de forma automatica.","lineNumber":46,"offsetAndLengths":[[21,9]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/inancgumus/learngo"},"file":{"path":"translation/chinese/02-编写第一个程序/main.go","url":"/github.com/inancgumus/learngo/-/blob/translation/chinese/02-%E7%BC%96%E5%86%99%E7%AC%AC%E4%B8%80%E4%B8%AA%E7%A8%8B%E5%BA%8F/main.go","content":"// Copyright © 2018 Inanc Gumus\n// Learn Go Programming Course\n// License: https://creativecommons.org/licenses/by-nc-sa/4.0/\n//\n// For more tutorials : https://learngoprogramming.com\n// In-person training : https://www.linkedin.com/in/inancgumus/\n// Follow me on twitter: https://twitter.com/inancgumus\n\n// package main 是一个特殊的包\n// 它允许 Go 创建一个可执行文件\npackage main\n\n/*\n这是一个多行注释\n\nimport 关键字引入另一个包\n 对于这个 .go ”文件“\n\nimport \"fmt\" 允许你使用 fmt 包的各种函数\n 在这个文件\n*/\nimport \"fmt\"\n\n// \"func main\" 是特殊的\n//\n// Go 必须知道从哪里开始执行\n//\n// func main 对于 Go 而言就是开始执行的位置\n//\n// 代码编译后,\n// Go runtime 第一个执行该函数\nfunc main() {\n\t// import \"fmt\" 之后\n\t// \"fmt\" 包中的 Println 函数就可以使用\n\n\t// 在控制台输入下面的命令可以查看它的源代码:\n\t// go doc -src fmt Println\n\n\t// Println 是一个 exported 函数来自\n\t// \"fmt\" 包\n\n\t// Exported = 首字母大写\n\tfmt.Println(\"Hello Gopher!\")\n\n\t// Go 本身不能调用 Println 函数\n\t// 这就是为什么你需要在这里调用它\n\t// Go 只能自动地调用 `func main`\n\n\t// -----\n\n\t// Go 字符串支持 Unicode 字符\n\t// 源代码同时也支持: KÖSTEBEK!\n\t//\n\t// 因为: 字面值 ~= 源代码\n\n\t// 练习: 删除下行注释的 --\u003e //\n\t// fmt.Println(\"Merhaba Köstebek!\")\n\n\t// 不重要的注释:\n\t// \"Merhaba Köstebek\" 的意思是 \"你好 Gopher\"\n\t// 在土耳其语\n}\n"},"lineMatches":[{"preview":"// \"func main\" 是特殊的","lineNumber":23,"offsetAndLengths":[[3,11]]},{"preview":"func main() {","lineNumber":31,"offsetAndLengths":[[0,9]]}]}]}}}}' headers: Content-Type: - application/json status: 200 OK code: 200 - duration: 1.25731525s + duration: 1.353031083s - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 51705 + content_length: 64261 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_d1922ceddb1049418e926ab0\",\"function\":{\"arguments\":\"{\\\"query\\\":\\\"lang:go func main\\\"}\",\"name\":\"sourcegraph\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"# Sourcegraph Search Results\\n\\nFound 30 matches across 30 results\\n(Result limit reached, try a more specific query)\\n\\n## Result 1: github.com/GoesToEleven/GolangTraining/14_functions/10_func-expression/01_before-func-expression/main.go\\n\\nURL: /github.com/GoesToEleven/GolangTraining/-/blob/14_functions/10_func-expression/01_before-func-expression/main.go\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func greeting() {\\n6| \\tfmt.Println(\\\"Hello world!\\\")\\n7| }\\n8| func main() {\\n9| func main() {\\n10| \\tgreeting()\\n11| }\\n12| \\n```\\n\\n```\\n0| package main\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func greeting() {\\n6| \\tfmt.Println(\\\"Hello world!\\\")\\n7| }\\n8| \\n9| func main() {\\n10| \\tgreeting()\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| func greeting() {\\n5| func greeting() {\\n6| \\tfmt.Println(\\\"Hello world!\\\")\\n7| }\\n8| \\n9| func main() {\\n10| \\tgreeting()\\n11| }\\n12| \\n```\\n\\n## Result 2: github.com/GoesToEleven/GolangTraining/14_functions/10_func-expression/02_func-expression/main.go\\n\\nURL: /github.com/GoesToEleven/GolangTraining/-/blob/14_functions/10_func-expression/02_func-expression/main.go\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| func main() {\\n5| func main() {\\n6| \\n7| \\tgreeting := func() {\\n8| \\t\\tfmt.Println(\\\"Hello world!\\\")\\n9| \\t}\\n10| \\n11| \\tgreeting()\\n12| }\\n13| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func main() {\\n6| \\tgreeting := func() {\\n7| \\tgreeting := func() {\\n8| \\t\\tfmt.Println(\\\"Hello world!\\\")\\n9| \\t}\\n10| \\n11| \\tgreeting()\\n12| }\\n13| \\n```\\n\\n```\\n0| package main\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func main() {\\n6| \\n7| \\tgreeting := func() {\\n8| \\t\\tfmt.Println(\\\"Hello world!\\\")\\n9| \\t}\\n10| \\n```\\n\\n## Result 3: github.com/jcalabro/uscope/assets/gobacktrace/main.go\\n\\nURL: /github.com/jcalabro/uscope/-/blob/assets/gobacktrace/main.go\\n\\n```\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| func main() {\\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| \\tFuncA()\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncB()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncC()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncD()\\n38| \\tFuncD()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncE()\\n39| \\tFuncE()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n34| func main() {\\n35| \\tFuncA()\\n36| \\tFuncB()\\n37| \\tFuncC()\\n38| \\tFuncD()\\n39| \\tFuncF()\\n40| \\tFuncF()\\n41| }\\n42| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| func FuncE() {\\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| \\tfmt.Println(\\\"FuncE\\\")\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| func FuncD() {\\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| \\tFuncE()\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tfmt.Println(\\\"FuncD\\\")\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n```\\n\\n```\\n3| import \\\"fmt\\\"\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| func FuncC() {\\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n```\\n\\n```\\n4| \\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| \\tFuncD()\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n```\\n\\n```\\n5| func FuncE() {\\n6| \\tfmt.Println(\\\"FuncE\\\")\\n7| }\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tfmt.Println(\\\"FuncC\\\")\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n```\\n\\n```\\n8| \\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| func FuncB() {\\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n```\\n\\n```\\n9| func FuncD() {\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| \\tFuncC()\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n```\\n\\n```\\n10| \\tFuncE()\\n11| \\tfmt.Println(\\\"FuncD\\\")\\n12| }\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tfmt.Println(\\\"FuncB\\\")\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| \\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n```\\n\\n```\\n13| \\n14| func FuncC() {\\n15| \\tFuncD()\\n16| \\tfmt.Println(\\\"FuncC\\\")\\n17| }\\n18| \\n19| func FuncB() {\\n20| \\tFuncC()\\n21| \\tfmt.Println(\\\"FuncB\\\")\\n22| }\\n23| func FuncA() {\\n24| func FuncA() {\\n25| \\tFuncB()\\n26| \\tfmt.Println(\\\"FuncA\\\")\\n27| }\\n28| \\n29| func FuncF() {\\n30| \\tfmt.Println(\\\"FuncF\\\")\\n31| \\tFuncE()\\n32| }\\n33| \\n```\\n\\n\",\"tool_call_id\":\"call_d1922ceddb1049418e926ab0\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/sourcegraph_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use sourcegraph to search for 'func main' in Go repositories\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_ea1945ebb1fc448191ecc6e0\",\"function\":{\"arguments\":\"{\\\"query\\\":\\\"\\\\\\\"func main\\\\\\\" lang:go\\\"}\",\"name\":\"sourcegraph\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"# Sourcegraph Search Results\\n\\nFound 30 matches across 30 results\\n(Result limit reached, try a more specific query)\\n\\n## Result 1: github.com/wx-chevalier/Go-Notes/99~参考资料/2017~A Huge Number of Go Examples/codes/first/first/main.go\\n\\nURL: /github.com/wx-chevalier/Go-Notes/-/blob/99~%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99/2017~A%20Huge%20Number%20of%20Go%20Examples/codes/first/first/main.go\\n\\n```\\n6| /*\\n7| This is a multi-line comment.\\n8| \\n9| import keyword makes another package available\\n10| for this .go \\\"file\\\".\\n11| \\n12| import \\\"fmt\\\" lets you access fmt package's functionality\\n13| here in this file.\\n14| */\\n15| import \\\"fmt\\\"\\n16| // \\\"func main\\\" is special.\\n17| // \\\"func main\\\" is special.\\n18| //\\n19| // Go has to know where to start\\n20| //\\n21| // func main creates a starting point for Go\\n22| //\\n23| // After compiling the code,\\n24| // Go runtime will first run this function\\n25| func main() {\\n26| \\t// after: import \\\"fmt\\\"\\n```\\n\\n```\\n14| */\\n15| import \\\"fmt\\\"\\n16| \\n17| // \\\"func main\\\" is special.\\n18| //\\n19| // Go has to know where to start\\n20| //\\n21| // func main creates a starting point for Go\\n22| //\\n23| // After compiling the code,\\n24| func main() {\\n25| func main() {\\n26| \\t// after: import \\\"fmt\\\"\\n27| \\t// Println function of \\\"fmt\\\" package becomes available\\n28| \\n29| \\t// Look at what it looks like by typing in the console:\\n30| \\t// godoc -src fmt Println\\n31| \\n32| \\t// Println is just an exported function from\\n33| \\t// \\\"fmt\\\" package\\n34| \\n```\\n\\n```\\n10| for this .go \\\"file\\\".\\n11| \\n12| import \\\"fmt\\\" lets you access fmt package's functionality\\n13| here in this file.\\n14| */\\n15| import \\\"fmt\\\"\\n16| \\n17| // \\\"func main\\\" is special.\\n18| //\\n19| // Go has to know where to start\\n20| // func main creates a starting point for Go\\n21| // func main creates a starting point for Go\\n22| //\\n23| // After compiling the code,\\n24| // Go runtime will first run this function\\n25| func main() {\\n26| \\t// after: import \\\"fmt\\\"\\n27| \\t// Println function of \\\"fmt\\\" package becomes available\\n28| \\n29| \\t// Look at what it looks like by typing in the console:\\n30| \\t// godoc -src fmt Println\\n```\\n\\n```\\n29| \\t// Look at what it looks like by typing in the console:\\n30| \\t// godoc -src fmt Println\\n31| \\n32| \\t// Println is just an exported function from\\n33| \\t// \\\"fmt\\\" package\\n34| \\n35| \\t// Exported = First Letter is uppercase\\n36| \\tfmt.Println(\\\"Hello Gopher!\\\")\\n37| \\n38| \\t// Go cannot call Println function by itself.\\n39| \\t// It only calls `func main` automatically.\\n40| \\t// It only calls `func main` automatically.\\n41| \\n42| \\t// -----\\n43| \\n44| \\t// Go supports Unicode characters in string literals\\n45| \\t// And also in source-code: KÖSTEBEK!\\n46| \\n47| \\t// EXERCISE: Remove the comments from below --> //\\n48| \\t// fmt.Println(\\\"Merhaba Köstebek!\\\")\\n49| \\n```\\n\\n## Result 2: github.com/wx-chevalier/Go-Notes/99~参考资料/2017~A Huge Number of Go Examples/codes/02-write-your-first-program/main.go\\n\\nURL: /github.com/wx-chevalier/Go-Notes/-/blob/99~%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99/2017~A%20Huge%20Number%20of%20Go%20Examples/codes/02-write-your-first-program/main.go\\n\\n```\\n6| /*\\n7| This is a multi-line comment.\\n8| \\n9| import keyword makes another package available\\n10| for this .go \\\"file\\\".\\n11| \\n12| import \\\"fmt\\\" lets you access fmt package's functionality\\n13| here in this file.\\n14| */\\n15| import \\\"fmt\\\"\\n16| // \\\"func main\\\" is special.\\n17| // \\\"func main\\\" is special.\\n18| //\\n19| // Go has to know where to start\\n20| //\\n21| // func main creates a starting point for Go\\n22| //\\n23| // After compiling the code,\\n24| // Go runtime will first run this function\\n25| func main() {\\n26| \\t// after: import \\\"fmt\\\"\\n```\\n\\n```\\n14| */\\n15| import \\\"fmt\\\"\\n16| \\n17| // \\\"func main\\\" is special.\\n18| //\\n19| // Go has to know where to start\\n20| //\\n21| // func main creates a starting point for Go\\n22| //\\n23| // After compiling the code,\\n24| func main() {\\n25| func main() {\\n26| \\t// after: import \\\"fmt\\\"\\n27| \\t// Println function of \\\"fmt\\\" package becomes available\\n28| \\n29| \\t// Look at what it looks like by typing in the console:\\n30| \\t// go doc -src fmt Println\\n31| \\n32| \\t// Println is just an exported function from\\n33| \\t// \\\"fmt\\\" package\\n34| \\n```\\n\\n```\\n10| for this .go \\\"file\\\".\\n11| \\n12| import \\\"fmt\\\" lets you access fmt package's functionality\\n13| here in this file.\\n14| */\\n15| import \\\"fmt\\\"\\n16| \\n17| // \\\"func main\\\" is special.\\n18| //\\n19| // Go has to know where to start\\n20| // func main creates a starting point for Go\\n21| // func main creates a starting point for Go\\n22| //\\n23| // After compiling the code,\\n24| // Go runtime will first run this function\\n25| func main() {\\n26| \\t// after: import \\\"fmt\\\"\\n27| \\t// Println function of \\\"fmt\\\" package becomes available\\n28| \\n29| \\t// Look at what it looks like by typing in the console:\\n30| \\t// go doc -src fmt Println\\n```\\n\\n```\\n29| \\t// Look at what it looks like by typing in the console:\\n30| \\t// go doc -src fmt Println\\n31| \\n32| \\t// Println is just an exported function from\\n33| \\t// \\\"fmt\\\" package\\n34| \\n35| \\t// Exported = First Letter is uppercase\\n36| \\tfmt.Println(\\\"Hello Gopher!\\\")\\n37| \\n38| \\t// Go cannot call Println function by itself.\\n39| \\t// It only calls `func main` automatically.\\n40| \\t// It only calls `func main` automatically.\\n41| \\n42| \\t// -----\\n43| \\n44| \\t// Go supports Unicode characters in string literals\\n45| \\t// And also in source-code: KÖSTEBEK!\\n46| \\t//\\n47| \\t// Because: Literal ~= Source Code\\n48| \\n49| \\t// EXERCISE: Remove the comments from below --> //\\n```\\n\\n## Result 3: github.com/wx-chevalier/Go-Notes/99~参考资料/2018~《Learn Go》/translation/chinese/02-编写第一个程序/main.go\\n\\nURL: /github.com/wx-chevalier/Go-Notes/-/blob/99~%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99/2018~%E3%80%8ALearn%20Go%E3%80%8B/translation/chinese/02-%E7%BC%96%E5%86%99%E7%AC%AC%E4%B8%80%E4%B8%AA%E7%A8%8B%E5%BA%8F/main.go\\n\\n```\\n13| /*\\n14| 这是一个多行注释\\n15| \\n16| import 关键字引入另一个包\\n17| 对于这个 .go ”文件“\\n18| \\n19| import \\\"fmt\\\" 允许你使用 fmt 包的各种函数\\n20| 在这个文件\\n21| */\\n22| import \\\"fmt\\\"\\n23| // \\\"func main\\\" 是特殊的\\n24| // \\\"func main\\\" 是特殊的\\n25| //\\n26| // Go 必须知道从哪里开始执行\\n27| //\\n28| // func main 对于 Go 而言就是开始执行的位置\\n29| //\\n30| // 代码编译后,\\n31| // Go runtime 第一个执行该函数\\n32| func main() {\\n33| \\t// import \\\"fmt\\\" 之后\\n```\\n\\n```\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" 是特殊的\\n25| //\\n26| // Go 必须知道从哪里开始执行\\n27| //\\n28| // func main 对于 Go 而言就是开始执行的位置\\n29| //\\n30| // 代码编译后,\\n31| func main() {\\n32| func main() {\\n33| \\t// import \\\"fmt\\\" 之后\\n34| \\t// \\\"fmt\\\" 包中的 Println 函数就可以使用\\n35| \\n36| \\t// 在控制台输入下面的命令可以查看它的源代码:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println 是一个 exported 函数来自\\n40| \\t// \\\"fmt\\\" 包\\n41| \\n```\\n\\n```\\n36| \\t// 在控制台输入下面的命令可以查看它的源代码:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println 是一个 exported 函数来自\\n40| \\t// \\\"fmt\\\" 包\\n41| \\n42| \\t// Exported = 首字母大写\\n43| \\tfmt.Println(\\\"Hello Gopher!\\\")\\n44| \\n45| \\t// Go 本身不能调用 Println 函数\\n46| \\t// Go 只能自动地调用 `func main`\\n47| \\t// Go 只能自动地调用 `func main`\\n48| \\n49| \\t// -----\\n50| \\n51| \\t// Go 字符串支持 Unicode 字符\\n52| \\t// 源代码同时也支持: KÖSTEBEK!\\n53| \\t//\\n54| \\t// 因为: 字面值 ~= 源代码\\n55| \\n56| \\t// 练习: 删除下行注释的 --> //\\n```\\n\\n```\\n17| 对于这个 .go ”文件“\\n18| \\n19| import \\\"fmt\\\" 允许你使用 fmt 包的各种函数\\n20| 在这个文件\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" 是特殊的\\n25| //\\n26| // Go 必须知道从哪里开始执行\\n27| // func main 对于 Go 而言就是开始执行的位置\\n28| // func main 对于 Go 而言就是开始执行的位置\\n29| //\\n30| // 代码编译后,\\n31| // Go runtime 第一个执行该函数\\n32| func main() {\\n33| \\t// import \\\"fmt\\\" 之后\\n34| \\t// \\\"fmt\\\" 包中的 Println 函数就可以使用\\n35| \\n36| \\t// 在控制台输入下面的命令可以查看它的源代码:\\n37| \\t// go doc -src fmt Println\\n```\\n\\n## Result 4: github.com/wx-chevalier/Go-Notes/99~参考资料/2018~《Learn Go》/first/first/main.go\\n\\nURL: /github.com/wx-chevalier/Go-Notes/-/blob/99~%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99/2018~%E3%80%8ALearn%20Go%E3%80%8B/first/first/main.go\\n\\n```\\n13| /*\\n14| This is a multi-line comment.\\n15| \\n16| import keyword makes another package available\\n17| for this .go \\\"file\\\".\\n18| \\n19| import \\\"fmt\\\" lets you access fmt package's functionality\\n20| here in this file.\\n21| */\\n22| import \\\"fmt\\\"\\n23| // \\\"func main\\\" is special.\\n24| // \\\"func main\\\" is special.\\n25| //\\n26| // Go has to know where to start\\n27| //\\n28| // func main creates a starting point for Go\\n29| //\\n30| // After compiling the code,\\n31| // Go runtime will first run this function\\n32| func main() {\\n33| \\t// after: import \\\"fmt\\\"\\n```\\n\\n```\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" is special.\\n25| //\\n26| // Go has to know where to start\\n27| //\\n28| // func main creates a starting point for Go\\n29| //\\n30| // After compiling the code,\\n31| func main() {\\n32| func main() {\\n33| \\t// after: import \\\"fmt\\\"\\n34| \\t// Println function of \\\"fmt\\\" package becomes available\\n35| \\n36| \\t// Look at what it looks like by typing in the console:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println is just an exported function from\\n40| \\t// \\\"fmt\\\" package\\n41| \\n```\\n\\n```\\n17| for this .go \\\"file\\\".\\n18| \\n19| import \\\"fmt\\\" lets you access fmt package's functionality\\n20| here in this file.\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" is special.\\n25| //\\n26| // Go has to know where to start\\n27| // func main creates a starting point for Go\\n28| // func main creates a starting point for Go\\n29| //\\n30| // After compiling the code,\\n31| // Go runtime will first run this function\\n32| func main() {\\n33| \\t// after: import \\\"fmt\\\"\\n34| \\t// Println function of \\\"fmt\\\" package becomes available\\n35| \\n36| \\t// Look at what it looks like by typing in the console:\\n37| \\t// go doc -src fmt Println\\n```\\n\\n```\\n36| \\t// Look at what it looks like by typing in the console:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println is just an exported function from\\n40| \\t// \\\"fmt\\\" package\\n41| \\n42| \\t// Exported = First Letter is uppercase\\n43| \\tfmt.Println(\\\"Hello Gopher!\\\")\\n44| \\n45| \\t// Go cannot call Println function by itself.\\n46| \\t// It only calls `func main` automatically.\\n47| \\t// It only calls `func main` automatically.\\n48| \\n49| \\t// -----\\n50| \\n51| \\t// Go supports Unicode characters in string literals\\n52| \\t// And also in source-code: KÖSTEBEK!\\n53| \\n54| \\t// EXERCISE: Remove the comments from below --> //\\n55| \\t// fmt.Println(\\\"Merhaba Köstebek!\\\")\\n56| \\n```\\n\\n## Result 5: github.com/wx-chevalier/Go-Notes/99~参考资料/2018~《Learn Go》/translation/spanish/02-tu-primer-programa/main.go\\n\\nURL: /github.com/wx-chevalier/Go-Notes/-/blob/99~%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99/2018~%E3%80%8ALearn%20Go%E3%80%8B/translation/spanish/02-tu-primer-programa/main.go\\n\\n```\\n13| /*\\n14| Esto es un comentario multilinea.\\n15| \\n16| la palabra import hace que otro paquete este disponible\\n17| para este \\\"archivo\\\" .go.\\n18| \\n19| import \\\"fmt\\\" te permite acceder a la funcionaliddad del paquete fmt\\n20| en este archivo.\\n21| */\\n22| import \\\"fmt\\\"\\n23| // \\\"func main\\\" es especial.\\n24| // \\\"func main\\\" es especial.\\n25| //\\n26| // Go tiene que saber por donde empezar\\n27| //\\n28| // func main crea un punto de inicio para Go\\n29| //\\n30| // Después de compilar el codigo,\\n31| // Go ejecutará esta función primero.\\n32| func main() {\\n33| \\t// después del: import \\\"fmt\\\"\\n```\\n\\n```\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" es especial.\\n25| //\\n26| // Go tiene que saber por donde empezar\\n27| //\\n28| // func main crea un punto de inicio para Go\\n29| //\\n30| // Después de compilar el codigo,\\n31| func main() {\\n32| func main() {\\n33| \\t// después del: import \\\"fmt\\\"\\n34| \\t// La función Println del paquete \\\"fmt\\\" estará disponible\\n35| \\n36| \\t// Lee sobre ella escribiendo los siguiente en la consola:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println es simplemente una función exportada de:\\n40| \\t// \\\"fmt\\\" package\\n41| \\n```\\n\\n```\\n17| para este \\\"archivo\\\" .go.\\n18| \\n19| import \\\"fmt\\\" te permite acceder a la funcionaliddad del paquete fmt\\n20| en este archivo.\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" es especial.\\n25| //\\n26| // Go tiene que saber por donde empezar\\n27| // func main crea un punto de inicio para Go\\n28| // func main crea un punto de inicio para Go\\n29| //\\n30| // Después de compilar el codigo,\\n31| // Go ejecutará esta función primero.\\n32| func main() {\\n33| \\t// después del: import \\\"fmt\\\"\\n34| \\t// La función Println del paquete \\\"fmt\\\" estará disponible\\n35| \\n36| \\t// Lee sobre ella escribiendo los siguiente en la consola:\\n37| \\t// go doc -src fmt Println\\n```\\n\\n```\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println es simplemente una función exportada de:\\n40| \\t// \\\"fmt\\\" package\\n41| \\n42| \\t// Para poder exportar una función tendrás que escribir el\\n43| \\t// primer caracter del nombre de la función en mayúscula.\\n44| \\tfmt.Println(\\\"Hello Gopher!\\\")\\n45| \\n46| \\t// Go no puede llamar a la función Println por si mismo.\\n47| \\t// Solo llama a la `func main` de forma automatica.\\n48| \\t// Solo llama a la `func main` de forma automatica.\\n49| \\n50| \\t// -----\\n51| \\n52| \\t// Go soporta caracteres unicode en cadenas de texto literal\\n53| \\t// y tambien en el codigo fuente: KÖSTEBEK!\\n54| \\t//\\n55| \\t// Porque: Literal ~= Codigo Fuente\\n56| }\\n57| \\n```\\n\\n## Result 6: github.com/wx-chevalier/Go-Notes/99~参考资料/2018~《Learn Go》/02-write-your-first-program/main.go\\n\\nURL: /github.com/wx-chevalier/Go-Notes/-/blob/99~%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99/2018~%E3%80%8ALearn%20Go%E3%80%8B/02-write-your-first-program/main.go\\n\\n```\\n13| /*\\n14| This is a multi-line comment.\\n15| \\n16| import keyword makes another package available\\n17| for this .go \\\"file\\\".\\n18| \\n19| import \\\"fmt\\\" lets you access fmt package's functionality\\n20| here in this file.\\n21| */\\n22| import \\\"fmt\\\"\\n23| // \\\"func main\\\" is special.\\n24| // \\\"func main\\\" is special.\\n25| //\\n26| // Go has to know where to start\\n27| //\\n28| // func main creates a starting point for Go\\n29| //\\n30| // After compiling the code,\\n31| // Go runtime will first run this function\\n32| func main() {\\n33| \\t// after: import \\\"fmt\\\"\\n```\\n\\n```\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" is special.\\n25| //\\n26| // Go has to know where to start\\n27| //\\n28| // func main creates a starting point for Go\\n29| //\\n30| // After compiling the code,\\n31| func main() {\\n32| func main() {\\n33| \\t// after: import \\\"fmt\\\"\\n34| \\t// Println function of \\\"fmt\\\" package becomes available\\n35| \\n36| \\t// Look at what it looks like by typing in the console:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println is just an exported function from\\n40| \\t// \\\"fmt\\\" package\\n41| \\n```\\n\\n```\\n17| for this .go \\\"file\\\".\\n18| \\n19| import \\\"fmt\\\" lets you access fmt package's functionality\\n20| here in this file.\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" is special.\\n25| //\\n26| // Go has to know where to start\\n27| // func main creates a starting point for Go\\n28| // func main creates a starting point for Go\\n29| //\\n30| // After compiling the code,\\n31| // Go runtime will first run this function\\n32| func main() {\\n33| \\t// after: import \\\"fmt\\\"\\n34| \\t// Println function of \\\"fmt\\\" package becomes available\\n35| \\n36| \\t// Look at what it looks like by typing in the console:\\n37| \\t// go doc -src fmt Println\\n```\\n\\n```\\n36| \\t// Look at what it looks like by typing in the console:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println is just an exported function from\\n40| \\t// \\\"fmt\\\" package\\n41| \\n42| \\t// Exported = First Letter is uppercase\\n43| \\tfmt.Println(\\\"Hello Gopher!\\\")\\n44| \\n45| \\t// Go cannot call Println function by itself.\\n46| \\t// It only calls `func main` automatically.\\n47| \\t// It only calls `func main` automatically.\\n48| \\n49| \\t// -----\\n50| \\n51| \\t// Go supports Unicode characters in string literals\\n52| \\t// And also in source-code: KÖSTEBEK!\\n53| \\t//\\n54| \\t// Because: Literal ~= Source Code\\n55| \\n56| \\t// EXERCISE: Remove the comments from below --> //\\n```\\n\\n## Result 7: github.com/Go-Learning-Land/Go-Learning-Archive/GolangBasics/learngo/translation/spanish/02-tu-primer-programa/main.go\\n\\nURL: /github.com/Go-Learning-Land/Go-Learning-Archive/-/blob/GolangBasics/learngo/translation/spanish/02-tu-primer-programa/main.go\\n\\n```\\n13| /*\\n14| Esto es un comentario multilinea.\\n15| \\n16| la palabra import hace que otro paquete este disponible\\n17| para este \\\"archivo\\\" .go.\\n18| \\n19| import \\\"fmt\\\" te permite acceder a la funcionaliddad del paquete fmt\\n20| en este archivo.\\n21| */\\n22| import \\\"fmt\\\"\\n23| // \\\"func main\\\" es especial.\\n24| // \\\"func main\\\" es especial.\\n25| //\\n26| // Go tiene que saber por donde empezar\\n27| //\\n28| // func main crea un punto de inicio para Go\\n29| //\\n30| // Despues de compilar el codigo,\\n31| // Go ejecutara esta funcion primero.\\n32| func main() {\\n33| \\t// despues del: import \\\"fmt\\\"\\n```\\n\\n```\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" es especial.\\n25| //\\n26| // Go tiene que saber por donde empezar\\n27| //\\n28| // func main crea un punto de inicio para Go\\n29| //\\n30| // Despues de compilar el codigo,\\n31| func main() {\\n32| func main() {\\n33| \\t// despues del: import \\\"fmt\\\"\\n34| \\t// La funcion Println del paquete \\\"fmt\\\" estara disponible\\n35| \\n36| \\t// Lee sobre ella escribiendo los siguiente en la consola:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println es simplemente una funcion exportada de:\\n40| \\t// \\\"fmt\\\" package\\n41| \\n```\\n\\n```\\n17| para este \\\"archivo\\\" .go.\\n18| \\n19| import \\\"fmt\\\" te permite acceder a la funcionaliddad del paquete fmt\\n20| en este archivo.\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" es especial.\\n25| //\\n26| // Go tiene que saber por donde empezar\\n27| // func main crea un punto de inicio para Go\\n28| // func main crea un punto de inicio para Go\\n29| //\\n30| // Despues de compilar el codigo,\\n31| // Go ejecutara esta funcion primero.\\n32| func main() {\\n33| \\t// despues del: import \\\"fmt\\\"\\n34| \\t// La funcion Println del paquete \\\"fmt\\\" estara disponible\\n35| \\n36| \\t// Lee sobre ella escribiendo los siguiente en la consola:\\n37| \\t// go doc -src fmt Println\\n```\\n\\n```\\n36| \\t// Lee sobre ella escribiendo los siguiente en la consola:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println es simplemente una funcion exportada de:\\n40| \\t// \\\"fmt\\\" package\\n41| \\n42| \\t// Exportada = Primera letra en mayuscula\\n43| \\tfmt.Println(\\\"Hello Gopher!\\\")\\n44| \\n45| \\t// Go no puede llamar a la funcion Println por si mismo.\\n46| \\t// Solo llama a la `func main` de forma automatica.\\n47| \\t// Solo llama a la `func main` de forma automatica.\\n48| \\n49| \\t// -----\\n50| \\n51| \\t// Go soporta caracteres unicode en cadenas de texto literal\\n52| \\t// y tambien en el codigo fuente: KÖSTEBEK!\\n53| \\t//\\n54| \\t// Porque: Literal ~= Codigo Fuente\\n55| }\\n56| \\n```\\n\\n## Result 8: github.com/inancgumus/learngo/translation/chinese/02-编写第一个程序/main.go\\n\\nURL: /github.com/inancgumus/learngo/-/blob/translation/chinese/02-%E7%BC%96%E5%86%99%E7%AC%AC%E4%B8%80%E4%B8%AA%E7%A8%8B%E5%BA%8F/main.go\\n\\n```\\n13| /*\\n14| 这是一个多行注释\\n15| \\n16| import 关键字引入另一个包\\n17| 对于这个 .go ”文件“\\n18| \\n19| import \\\"fmt\\\" 允许你使用 fmt 包的各种函数\\n20| 在这个文件\\n21| */\\n22| import \\\"fmt\\\"\\n23| // \\\"func main\\\" 是特殊的\\n24| // \\\"func main\\\" 是特殊的\\n25| //\\n26| // Go 必须知道从哪里开始执行\\n27| //\\n28| // func main 对于 Go 而言就是开始执行的位置\\n29| //\\n30| // 代码编译后,\\n31| // Go runtime 第一个执行该函数\\n32| func main() {\\n33| \\t// import \\\"fmt\\\" 之后\\n```\\n\\n```\\n21| */\\n22| import \\\"fmt\\\"\\n23| \\n24| // \\\"func main\\\" 是特殊的\\n25| //\\n26| // Go 必须知道从哪里开始执行\\n27| //\\n28| // func main 对于 Go 而言就是开始执行的位置\\n29| //\\n30| // 代码编译后,\\n31| func main() {\\n32| func main() {\\n33| \\t// import \\\"fmt\\\" 之后\\n34| \\t// \\\"fmt\\\" 包中的 Println 函数就可以使用\\n35| \\n36| \\t// 在控制台输入下面的命令可以查看它的源代码:\\n37| \\t// go doc -src fmt Println\\n38| \\n39| \\t// Println 是一个 exported 函数来自\\n40| \\t// \\\"fmt\\\" 包\\n41| \\n```\\n\\n\",\"tool_call_id\":\"call_ea1945ebb1fc448191ecc6e0\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -138,95 +400,101 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Found"}}]} + + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" "}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"30"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Found"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" matches"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" "}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" for"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"30"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" `"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" matches"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"func"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" for"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" `"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"`"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"func"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" in"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"`"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" repositories"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" in"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" The"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" repositories"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" results"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" across"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" show"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" various"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" educational"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" training"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" examples"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" materials"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" and"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" and"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" tutorials"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" example"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" from"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" projects"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" various"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" The"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" learning"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" results"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" repositories"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" include"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" basic"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" most"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" being"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" World"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" simple"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\""}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" examples"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" World"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" function"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\""}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" expression"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" style"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" demonstrations"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" programs"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" that"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" and"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" demonstrate"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" more"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" complex"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" basic"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" multi"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" structure"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"-function"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" of"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" call"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Go"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" patterns"}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" applications"}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} - data: {"id":"202510290409552738a481fe8346cd","created":1761682195,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":13307,"completion_tokens":47,"total_tokens":13354,"prompt_tokens_details":{"cached_tokens":10530}}} + data: {"id":"2025102918324504ea08fc165a46a8","created":1761733965,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":16891,"completion_tokens":50,"total_tokens":16941,"prompt_tokens_details":{"cached_tokens":10281}}} data: [DONE] @@ -235,4 +503,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 968.288541ms + duration: 1.033145042s diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/update_a_file.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/update_a_file.yaml index f42013b7965017b8941121197f2184229392db86..0b5cbc5dfe6c48e3a952ccfb698bb31222b51c7d 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/update_a_file.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/update_a_file.yaml @@ -24,19 +24,25 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510290409211c3e7a5180404c72","created":1761682161,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251029183204383353ac76db4b68","created":1761733924,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510290409211c3e7a5180404c72","created":1761682161,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Update"}}]} + data: {"id":"20251029183204383353ac76db4b68","created":1761733924,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Update"}}]} - data: {"id":"202510290409211c3e7a5180404c72","created":1761682161,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} + data: {"id":"20251029183204383353ac76db4b68","created":1761733924,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} - data: {"id":"202510290409211c3e7a5180404c72","created":1761682161,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} + data: {"id":"20251029183204383353ac76db4b68","created":1761733924,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} - data: {"id":"202510290409211c3e7a5180404c72","created":1761682161,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" print"}}]} + data: {"id":"20251029183204383353ac76db4b68","created":1761733924,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" to"}}]} - data: {"id":"202510290409211c3e7a5180404c72","created":1761682161,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" message"}}]} + data: {"id":"20251029183204383353ac76db4b68","created":1761733924,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" print"}}]} - data: {"id":"202510290409211c3e7a5180404c72","created":1761682161,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":134,"completion_tokens":9,"total_tokens":143,"prompt_tokens_details":{"cached_tokens":4}}} + data: {"id":"20251029183204383353ac76db4b68","created":1761733924,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" hello"}}]} + + data: {"id":"20251029183204383353ac76db4b68","created":1761733924,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" from"}}]} + + data: {"id":"20251029183204383353ac76db4b68","created":1761733924,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" crush"}}]} + + data: {"id":"20251029183204383353ac76db4b68","created":1761733924,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":134,"completion_tokens":12,"total_tokens":146,"prompt_tokens_details":{"cached_tokens":114}}} data: [DONE] @@ -45,15 +51,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 651.769584ms + duration: 615.001083ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 43983 + content_length: 42694 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -69,172 +75,153 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"The"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"The"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" user"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" user"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" wants"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" wants"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" me"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" me"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" update"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" update"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" a"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".go"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".go"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" file"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" file"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" by"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" changing"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" change"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" a"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" print"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" print"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" statement"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" say"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" \""}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" say"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"hello"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" \""}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" from"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"hello"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" crush"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" from"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"\"."}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" crush"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" First"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"\"."}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" I"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" need"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" need"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":":\n\n"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" find"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"1"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" and"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" read"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" First"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" find"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".go"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" file"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".go"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" file"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" see"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" what"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"2"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"'s"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" currently"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Read"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" there"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" it"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":","}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" then"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" understand"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" make"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" current"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" necessary"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" print"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" edit"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" statement"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".\n\n"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"Let"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"3"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" me"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" start"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" Edit"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" by"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" it"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" finding"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" change"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".go"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" print"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" file"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" to"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" and"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" \""}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" reading"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"hello"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" its"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" from"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" contents"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" crush"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"\"\n\n"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"Let"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_b46e70e7653544e29775d59f","index":0,"type":"function","function":{"name":"glob","arguments":"{\"pattern\":\"**/main.go\"}"}}]}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" me"}}]} - data: {"id":"2025102904092228edaaa242504257","created":1761682162,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10578,"completion_tokens":80,"total_tokens":10658,"prompt_tokens_details":{"cached_tokens":10530}}} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" start"}}]} - data: [DONE] + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" by"}}]} - headers: - Content-Type: - - text/event-stream;charset=UTF-8 - status: 200 OK - code: 200 - duration: 850.83425ms -- id: 2 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 44300 - host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_b46e70e7653544e29775d59f\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"**/main.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\",\"tool_call_id\":\"call_b46e70e7653544e29775d59f\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" - headers: - Accept: - - application/json - Content-Type: - - application/json - User-Agent: - - OpenAI/Go 2.7.1 - url: https://api.z.ai/api/coding/paas/v4/chat/completions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - content_length: -1 - body: |+ - data: {"id":"2025102904092383e3ebc9161c434d","created":1761682163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" finding"}}]} + + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" the"}}]} + + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" main"}}]} + + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":".go"}}]} - data: {"id":"2025102904092383e3ebc9161c434d","created":1761682163,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":" file"}}]} - data: {"id":"2025102904092383e3ebc9161c434d","created":1761682163,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_36f62bda16244d328faee812","index":0,"type":"function","function":{"name":"view","arguments":"{\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\"}"}}]}}]} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","reasoning_content":"."}}]} - data: {"id":"2025102904092383e3ebc9161c434d","created":1761682163,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10623,"completion_tokens":36,"total_tokens":10659,"prompt_tokens_details":{"cached_tokens":45}}} + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_0d013783d99841168f8c8fc0","index":0,"type":"function","function":{"name":"glob","arguments":"{\"pattern\":\"**/main.go\"}"}}]}}]} + + data: {"id":"20251029183204b52b98b9a9f742ce","created":1761733924,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10280,"completion_tokens":90,"total_tokens":10370,"prompt_tokens_details":{"cached_tokens":45}}} data: [DONE] @@ -243,15 +230,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 1.181350208s -- id: 3 + duration: 5.139200333s +- id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44761 + content_length: 43011 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_b46e70e7653544e29775d59f\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"**/main.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\",\"tool_call_id\":\"call_b46e70e7653544e29775d59f\",\"role\":\"tool\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_36f62bda16244d328faee812\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_36f62bda16244d328faee812\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_0d013783d99841168f8c8fc0\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"**/main.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\",\"tool_call_id\":\"call_0d013783d99841168f8c8fc0\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -267,13 +254,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029040924fd9cbd720aab4fe8","created":1761682164,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"202510291832112f6d82ddcdd54b74","created":1761733931,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"20251029040924fd9cbd720aab4fe8","created":1761682164,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510291832112f6d82ddcdd54b74","created":1761733931,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029040924fd9cbd720aab4fe8","created":1761682164,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_d2274ef0b65f4a50b4b453df","index":0,"type":"function","function":{"name":"edit","arguments":"{\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\",\"old_string\":\"\\tfmt.Println(\\\"Hello, World!\\\")\",\"new_string\":\"\\tfmt.Println(\\\"hello from crush\\\")\"}"}}]}}]} + data: {"id":"202510291832112f6d82ddcdd54b74","created":1761733931,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_f13a7b1d3599463f82e87d33","index":0,"type":"function","function":{"name":"view","arguments":"{\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\"}"}}]}}]} - data: {"id":"20251029040924fd9cbd720aab4fe8","created":1761682164,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10716,"completion_tokens":66,"total_tokens":10782,"prompt_tokens_details":{"cached_tokens":10530}}} + data: {"id":"202510291832112f6d82ddcdd54b74","created":1761733931,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10325,"completion_tokens":36,"total_tokens":10361,"prompt_tokens_details":{"cached_tokens":45}}} data: [DONE] @@ -282,15 +269,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 708.402959ms -- id: 4 + duration: 6.082350917s +- id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45299 + content_length: 43472 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_b46e70e7653544e29775d59f\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"**/main.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\",\"tool_call_id\":\"call_b46e70e7653544e29775d59f\",\"role\":\"tool\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_36f62bda16244d328faee812\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_36f62bda16244d328faee812\",\"role\":\"tool\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_d2274ef0b65f4a50b4b453df\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\\",\\\"old_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\",\\\"new_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"hello from crush\\\\\\\")\\\"}\",\"name\":\"edit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\n\\n\",\"tool_call_id\":\"call_d2274ef0b65f4a50b4b453df\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_0d013783d99841168f8c8fc0\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"**/main.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\",\"tool_call_id\":\"call_0d013783d99841168f8c8fc0\",\"role\":\"tool\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_f13a7b1d3599463f82e87d33\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_f13a7b1d3599463f82e87d33\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -306,13 +293,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"202510290409259112b55f57e14580","created":1761682165,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"2025102918321849e11e01bc4d4ece","created":1761733938,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"202510290409259112b55f57e14580","created":1761682165,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102918321849e11e01bc4d4ece","created":1761733938,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"202510290409259112b55f57e14580","created":1761682165,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_8975caca0eb74c018a0dd34b","index":0,"type":"function","function":{"name":"bash","arguments":"{\"command\":\"cd /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file && go run main.go\",\"description\":\"Test the updated Go program\"}"}}]}}]} + data: {"id":"2025102918321849e11e01bc4d4ece","created":1761733938,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_92e7e7d9220249af8d090a8a","index":0,"type":"function","function":{"name":"edit","arguments":"{\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\",\"old_string\":\"\\tfmt.Println(\\\"Hello, World!\\\")\",\"new_string\":\"\\tfmt.Println(\\\"hello from crush\\\")\"}"}}]}}]} - data: {"id":"202510290409259112b55f57e14580","created":1761682165,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10819,"completion_tokens":52,"total_tokens":10871,"prompt_tokens_details":{"cached_tokens":10580}}} + data: {"id":"2025102918321849e11e01bc4d4ece","created":1761733938,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10418,"completion_tokens":66,"total_tokens":10484,"prompt_tokens_details":{"cached_tokens":10232}}} data: [DONE] @@ -321,15 +308,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 710.030792ms -- id: 5 + duration: 819.076833ms +- id: 4 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 45755 + content_length: 44010 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_b46e70e7653544e29775d59f\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"**/main.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\",\"tool_call_id\":\"call_b46e70e7653544e29775d59f\",\"role\":\"tool\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_36f62bda16244d328faee812\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_36f62bda16244d328faee812\",\"role\":\"tool\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_d2274ef0b65f4a50b4b453df\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\\",\\\"old_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\",\\\"new_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"hello from crush\\\\\\\")\\\"}\",\"name\":\"edit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\n\\n\",\"tool_call_id\":\"call_d2274ef0b65f4a50b4b453df\",\"role\":\"tool\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_8975caca0eb74c018a0dd34b\",\"function\":{\"arguments\":\"{\\\"command\\\":\\\"cd /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file && go run main.go\\\",\\\"description\\\":\\\"Test the updated Go program\\\"}\",\"name\":\"bash\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"hello from crush\\n\\n\\n/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file\",\"tool_call_id\":\"call_8975caca0eb74c018a0dd34b\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"update the main.go file by changing the print to say hello from crush\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_0d013783d99841168f8c8fc0\",\"function\":{\"arguments\":\"{\\\"pattern\\\":\\\"**/main.go\\\"}\",\"name\":\"glob\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\",\"tool_call_id\":\"call_0d013783d99841168f8c8fc0\",\"role\":\"tool\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_f13a7b1d3599463f82e87d33\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\\"}\",\"name\":\"view\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\n 1|package main\\n 2|\\n 3|import \\\"fmt\\\"\\n 4|\\n 5|func main() {\\n 6|\\tfmt.Println(\\\"Hello, World!\\\")\\n 7|}\\n\\n\",\"tool_call_id\":\"call_f13a7b1d3599463f82e87d33\",\"role\":\"tool\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_92e7e7d9220249af8d090a8a\",\"function\":{\"arguments\":\"{\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\\",\\\"old_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"Hello, World!\\\\\\\")\\\",\\\"new_string\\\":\\\"\\\\tfmt.Println(\\\\\\\"hello from crush\\\\\\\")\\\"}\",\"name\":\"edit\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nContent replaced in file: /tmp/crush-test/TestCoderAgent/zai-glm4.6/update_a_file/main.go\\n\\n\",\"tool_call_id\":\"call_92e7e7d9220249af8d090a8a\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -345,49 +332,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Done"}}]} - - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} - - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" Updated"}}]} - - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" main"}}]} - - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".go"}}]} - - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" to"}}]} - - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" print"}}]} - - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} - - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"hello"}}]} - - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" from"}}]} - - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" crush"}}]} - - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\""}}]} - - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" instead"}}]} - - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" of"}}]} - - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" \""}}]} - - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"}}]} - - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]} + data: {"id":"20251029183219b35194b58d4c42bc","created":1761733939,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" World"}}]} + data: {"id":"20251029183219b35194b58d4c42bc","created":1761733939,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"!\""}}]} + data: {"id":"20251029183219b35194b58d4c42bc","created":1761733939,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Done"}}]} - data: {"id":"20251029040927888d273fad804523","created":1761682167,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10903,"completion_tokens":24,"total_tokens":10927,"prompt_tokens_details":{"cached_tokens":45}}} + data: {"id":"20251029183219b35194b58d4c42bc","created":1761733939,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10521,"completion_tokens":6,"total_tokens":10527,"prompt_tokens_details":{"cached_tokens":10483}}} data: [DONE] @@ -396,4 +347,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 1.365427375s + duration: 722.492333ms diff --git a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/write_tool.yaml b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/write_tool.yaml index 759378fec1cd13dc1fa5f10afe3b6677d1c544a6..513948259d6b50090d90b47b4332fcb66f6ecb4e 100644 --- a/internal/agent/testdata/TestCoderAgent/zai-glm4.6/write_tool.yaml +++ b/internal/agent/testdata/TestCoderAgent/zai-glm4.6/write_tool.yaml @@ -24,21 +24,21 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"20251029040956e75079d164ca44d0","created":1761682196,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102918324772f21754518745ad","created":1761733967,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"20251029040956e75079d164ca44d0","created":1761682196,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Create"}}]} + data: {"id":"2025102918324772f21754518745ad","created":1761733967,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":"Create"}}]} - data: {"id":"20251029040956e75079d164ca44d0","created":1761682196,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" config"}}]} + data: {"id":"2025102918324772f21754518745ad","created":1761733967,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" config"}}]} - data: {"id":"20251029040956e75079d164ca44d0","created":1761682196,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":".json"}}]} + data: {"id":"2025102918324772f21754518745ad","created":1761733967,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":".json"}}]} - data: {"id":"20251029040956e75079d164ca44d0","created":1761682196,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} + data: {"id":"2025102918324772f21754518745ad","created":1761733967,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} - data: {"id":"20251029040956e75079d164ca44d0","created":1761682196,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" JSON"}}]} + data: {"id":"2025102918324772f21754518745ad","created":1761733967,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" JSON"}}]} - data: {"id":"20251029040956e75079d164ca44d0","created":1761682196,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" content"}}]} + data: {"id":"2025102918324772f21754518745ad","created":1761733967,"model":"glm-4.5-air","choices":[{"index":0,"delta":{"role":"assistant","content":" content"}}]} - data: {"id":"20251029040956e75079d164ca44d0","created":1761682196,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":148,"completion_tokens":10,"total_tokens":158,"prompt_tokens_details":{"cached_tokens":115}}} + data: {"id":"2025102918324772f21754518745ad","created":1761733967,"model":"glm-4.5-air","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":148,"completion_tokens":10,"total_tokens":158,"prompt_tokens_details":{"cached_tokens":115}}} data: [DONE] @@ -47,15 +47,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 619.585583ms + duration: 658.645917ms - id: 1 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44020 + content_length: 42731 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -71,13 +71,13 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"2025102904095657313086bf354bd1","created":1761682196,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"2025102918324792caa0b563714f0b","created":1761733967,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"2025102904095657313086bf354bd1","created":1761682196,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"2025102918324792caa0b563714f0b","created":1761733967,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"2025102904095657313086bf354bd1","created":1761682196,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_2fde44e2b4644e2f8c5ebd85","index":0,"type":"function","function":{"name":"write","arguments":"{\"content\":\"{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}\",\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/write_tool/config.json\"}"}}]}}]} + data: {"id":"2025102918324792caa0b563714f0b","created":1761733967,"model":"glm-4.6","choices":[{"index":0,"delta":{"tool_calls":[{"id":"call_19ceb1a698a14e929da1d909","index":0,"type":"function","function":{"name":"write","arguments":"{\"content\":\"{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}\",\"file_path\":\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/write_tool/config.json\"}"}}]}}]} - data: {"id":"2025102904095657313086bf354bd1","created":1761682196,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10592,"completion_tokens":58,"total_tokens":10650,"prompt_tokens_details":{"cached_tokens":10530}}} + data: {"id":"2025102918324792caa0b563714f0b","created":1761733967,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"tool_calls","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10294,"completion_tokens":58,"total_tokens":10352,"prompt_tokens_details":{"cached_tokens":10232}}} data: [DONE] @@ -86,15 +86,15 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 678.758667ms + duration: 724.87625ms - id: 2 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 44520 + content_length: 43231 host: "" - body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_2fde44e2b4644e2f8c5ebd85\",\"function\":{\"arguments\":\"{\\\"content\\\":\\\"{\\\\\\\"name\\\\\\\": \\\\\\\"test\\\\\\\", \\\\\\\"version\\\\\\\": \\\\\\\"1.0.0\\\\\\\"}\\\",\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/write_tool/config.json\\\"}\",\"name\":\"write\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nFile successfully written: /tmp/crush-test/TestCoderAgent/zai-glm4.6/write_tool/config.json\\n\",\"tool_call_id\":\"call_2fde44e2b4644e2f8c5ebd85\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"fetch\",\"strict\":false,\"description\":\"Fetches content from URL and returns it in specified format.\\n\\n\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n\\n\\n\\n- Supports three output formats: text, markdown, html\\n- Auto-handles HTTP redirects\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max response size: 5MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n\\n\\n\\n- Use text format for plain text content or simple API responses\\n- Use markdown format for content that should be rendered with formatting\\n- Use html format when you need raw HTML structure\\n- Set appropriate timeouts for potentially slow websites\\n\\n\",\"parameters\":{\"properties\":{\"format\":{\"description\":\"The format to return the content in (text, markdown, or html)\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to fetch content from\",\"type\":\"string\"}},\"required\":[\"url\",\"format\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" + body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n\\nThese rules override everything else. Follow them strictly:\\n\\n1. **ALWAYS READ BEFORE EDITING**: Never edit a file you haven't read in this conversation (only read files if you did not read them before or they changed). When reading, pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.\\n2. **BE AUTONOMOUS**: Don't ask questions - search, read, decide, act. Complete the ENTIRE task before stopping. Never stop mid-task. Never refuse work based on scope or complexity - break it down and do it.\\n3. **TEST AFTER CHANGES**: Run tests immediately after each modification\\n4. **BE CONCISE**: Under 4 lines unless user asks for detail\\n5. **USE EXACT MATCHES**: When editing, match text exactly including whitespace, indentation, and line breaks\\n6. **NEVER COMMIT**: Unless user explicitly says \\\"commit\\\"\\n7. **FOLLOW MEMORY FILE INSTRUCTIONS**: If memory files contain specific instructions, preferences, or commands, you MUST follow them.\\n8. **NEVER ADD COMMENTS**: Only add comments if the user asked you to do so. When adding comments, focus on *why* not *what*. NEVER communicate with the user through code comments.\\n9. **SECURITY FIRST**: Only assist with defensive security tasks. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\\n10. **NO URL GUESSING**: Never generate or guess URLs unless you are confident they are for helping with programming. Only use URLs provided by the user or found in local files.\\n11. **NEVER PUSH TO REMOTE**: Don't push changes to remote repositories unless explicitly asked by the user.\\n12. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.\\n13. **COMPLETE THE TASK**: Never stop mid-task with \\\"Next:\\\" or \\\"Will do:\\\" statements. If you describe what needs to be done, DO IT immediately. Only stop when everything is finished.\\n14. **NEVER REFUSE BASED ON SCOPE**: Never refuse tasks because they seem large or complex. Break them into steps and complete them. Only stop if you encounter actual blocking errors (missing dependencies, compile failures, etc.), not perceived difficulty.\\n\\n\\n\\nKeep responses minimal:\\n- Under 4 lines of text (tool use doesn't count)\\n- No preamble (\\\"Here's...\\\", \\\"I'll...\\\")\\n- No postamble (\\\"Let me know...\\\", \\\"Hope this helps...\\\")\\n- One-word answers when possible\\n- No emojis ever\\n- No explanations unless user asks\\n\\nExamples:\\nuser: what is 2+2?\\nassistant: 4\\n\\nuser: list files in src/\\nassistant: [uses ls tool]\\nfoo.c, bar.c, baz.c\\n\\nuser: which file has the foo implementation?\\nassistant: src/foo.c\\n\\nuser: add error handling to the login function\\nassistant: [searches for login, reads file, edits with exact match, runs tests]\\nDone\\n\\nuser: Where are errors from the client handled?\\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.go:712.\\n\\n\\n\\nWhen referencing specific functions or code locations, use the pattern `file_path:line_number` to help users navigate:\\n- Example: \\\"The error is handled in src/main.go:45\\\"\\n- Example: \\\"See the implementation in pkg/utils/helper.go:123-145\\\"\\n\\n\\n\\nFor every task, follow this sequence internally (don't narrate it):\\n\\n**Before acting**:\\n- Search codebase for relevant files\\n- Read files to understand current state\\n- Check memory for stored commands\\n- Identify what needs to change\\n- Use `git log` and `git blame` for additional context when needed\\n\\n**While acting**:\\n- Read entire file before editing it\\n- Before editing: verify exact whitespace and indentation from View output\\n- Use exact text for find/replace (include whitespace)\\n- Make one logical change at a time\\n- After each change: run tests\\n- If tests fail: fix immediately\\n- If edit fails: read more context, don't guess - the text must match exactly\\n- Keep going until query is completely resolved before yielding to user\\n- For longer tasks, send brief progress updates (under 10 words) BUT IMMEDIATELY CONTINUE WORKING - progress updates are not stopping points\\n\\n**Before finishing**:\\n- Verify ENTIRE query is resolved (not just first step)\\n- All described next steps must be completed\\n- Run lint/typecheck if in memory\\n- Verify all changes work\\n- Keep response under 4 lines\\n\\n**Key behaviors**:\\n- Use find_references before changing shared code\\n- Follow existing patterns (check similar files)\\n- If stuck, try different approach (don't repeat failures)\\n- Make decisions yourself (search first, don't ask)\\n- Fix problems at root cause, not surface-level patches\\n- Don't fix unrelated bugs or broken tests (mention them in final message if relevant)\\n\\n\\n\\n**Make decisions autonomously** - don't ask when you can:\\n- Search to find the answer\\n- Read files to see patterns\\n- Check similar code\\n- Infer from context\\n- Try most likely approach\\n\\n**Only stop/ask user if**:\\n- Truly ambiguous business requirement\\n- Multiple valid approaches with big tradeoffs\\n- Could cause data loss\\n- Exhausted all attempts and hit actual blocking errors\\n\\n**Never stop for**:\\n- Task seems too large (break it down)\\n- Multiple files to change (change them)\\n- Concerns about \\\"session limits\\\" (no such limits exist)\\n- Work will take many steps (do all the steps)\\n\\nExamples of autonomous decisions:\\n- File location → search for similar files\\n- Test command → check package.json/memory\\n- Code style → read existing code\\n- Library choice → check what's used\\n- Naming → follow existing names\\n\\n\\n\\n**No task is too large**:\\n- Break complex tasks into logical steps\\n- Complete each step fully before moving to next\\n- If a task has 10 parts, do all 10 parts\\n- Don't estimate effort or refuse based on scope\\n- Only stop if you hit actual errors (compile failures, missing files, etc.)\\n\\n**For large refactors or implementations**:\\n- Start with core functionality\\n- Build incrementally\\n- Test at each step\\n- Keep going until fully complete\\n\\nThere are no \\\"session limits\\\" - continue until the task is done or you hit a real blocker.\\n\\n\\n\\nCritical: ALWAYS read files before editing them in this conversation.\\n\\nWhen using edit tools:\\n1. Read the file first - note the EXACT indentation (spaces vs tabs, count)\\n2. Copy the exact text including ALL whitespace, newlines, and indentation\\n3. Include 3-5 lines of context before and after the target\\n4. Verify your old_string would appear exactly once in the file\\n5. If uncertain about whitespace, include more surrounding context\\n6. Verify edit succeeded\\n7. Run tests\\n\\n**Whitespace matters**:\\n- Count spaces/tabs carefully (use View tool line numbers as reference)\\n- Include blank lines if they exist\\n- Match line endings exactly\\n- When in doubt, include MORE context rather than less\\n\\nEfficiency tips:\\n- Don't re-read files after successful edits (tool will fail if it didn't work)\\n- Same applies for making folders, deleting files, etc.\\n\\nCommon mistakes to avoid:\\n- Editing without reading first\\n- Approximate text matches\\n- Wrong indentation (spaces vs tabs, wrong count)\\n- Missing or extra blank lines\\n- Not enough context (text appears multiple times)\\n- Trimming whitespace that exists in the original\\n- Not testing after changes\\n\\n\\n\\nThe Edit tool is extremely literal. \\\"Close enough\\\" will fail.\\n\\n**Before every edit**:\\n1. View the file and locate the exact lines to change\\n2. Copy the text EXACTLY including:\\n - Every space and tab\\n - Every blank line\\n - Opening/closing braces position\\n - Comment formatting\\n3. Include enough surrounding lines (3-5) to make it unique\\n4. Double-check indentation level matches\\n\\n**Common failures**:\\n- `func foo() {` vs `func foo(){` (space before brace)\\n- Tab vs 4 spaces vs 2 spaces\\n- Missing blank line before/after\\n- `// comment` vs `//comment` (space after //)\\n- Different number of spaces in indentation\\n\\n**If edit fails**:\\n- View the file again at the specific location\\n- Copy even more context\\n- Check for tabs vs spaces\\n- Verify line endings\\n- Try including the entire function/block if needed\\n- Never retry with guessed changes - get the exact text first\\n\\n\\n\\nWhen errors occur:\\n1. Read complete error message\\n2. Understand root cause\\n3. Try different approach (don't repeat same action)\\n4. Search for similar code that works\\n5. Make targeted fix\\n6. Test to verify\\n\\nCommon errors:\\n- Import/Module → check paths, spelling, what exists\\n- Syntax → check brackets, indentation, typos\\n- Tests fail → read test, see what it expects\\n- File not found → use ls, check exact path\\n\\n**Edit tool \\\"old_string not found\\\"**:\\n- View the file again at the target location\\n- Copy the EXACT text including all whitespace\\n- Include more surrounding context (full function if needed)\\n- Check for tabs vs spaces, extra/missing blank lines\\n- Count indentation spaces carefully\\n- Don't retry with approximate matches - get the exact text\\n\\n\\n\\nMemory files store commands, preferences, and codebase info. Update them when you discover:\\n- Build/test/lint commands\\n- Code style preferences \\n- Important codebase patterns\\n- Useful project information\\n\\n\\n\\nBefore writing code:\\n1. Check if library exists (look at imports, package.json)\\n2. Read similar code for patterns\\n3. Match existing style\\n4. Use same libraries/frameworks\\n5. Follow security best practices (never log secrets)\\n6. Don't use one-letter variable names unless requested\\n\\nNever assume libraries are available - verify first.\\n\\n**Ambition vs. precision**:\\n- New projects → be creative and ambitious with implementation\\n- Existing codebases → be surgical and precise, respect surrounding code\\n- Don't change filenames or variables unnecessarily\\n- Don't add formatters/linters/tests to codebases that don't have them\\n\\n\\n\\nAfter significant changes:\\n- Start testing as specific as possible to code changed, then broaden to build confidence\\n- Use self-verification: write unit tests, add output logs, or use debug statements to verify your solutions\\n- Run relevant test suite\\n- If tests fail, fix before continuing\\n- Check memory for test commands\\n- Run lint/typecheck if available (on precise targets when possible)\\n- For formatters: iterate max 3 times to get it right; if still failing, present correct solution and note formatting issue\\n- Suggest adding commands to memory if not found\\n- Don't fix unrelated bugs or test failures (not your responsibility)\\n\\n\\n\\n- Search before assuming\\n- Read files before editing\\n- Always use absolute paths for file operations (editing, reading, writing)\\n- Use Agent tool for complex searches\\n- Run tools in parallel when safe (no dependencies)\\n- When making multiple independent bash calls, send them in a single message with multiple tool calls for parallel execution\\n- Summarize tool output for user (they don't see it)\\n\\n\\nWhen running non-trivial bash commands (especially those that modify the system):\\n- Briefly explain what the command does and why you're running it\\n- This ensures the user understands potentially dangerous operations\\n- Simple read-only commands (ls, cat, etc.) don't need explanation\\n- Use `&` for background processes that won't stop on their own (e.g., `node server.js &`)\\n- Avoid interactive commands - use non-interactive versions (e.g., `npm init -y` not `npm init`)\\n- Combine related commands to save time (e.g., `git status && git diff HEAD && git log -n 3`)\\n\\n\\n\\n\\nBalance autonomy with user intent:\\n- When asked to do something → do it fully (including ALL follow-ups and \\\"next steps\\\")\\n- Never describe what you'll do next - just do it\\n- When asked how to approach → explain first, don't auto-implement\\n- After completing work → stop, don't explain (unless asked)\\n- Don't surprise user with unexpected actions\\n\\n\\n\\nAdapt verbosity to match the work completed:\\n\\n**Default (under 4 lines)**:\\n- Simple questions or single-file changes\\n- Casual conversation, greetings, acknowledgements\\n- One-word answers when possible\\n\\n**More detail allowed (up to 10-15 lines)**:\\n- Large multi-file changes that need walkthrough\\n- Complex refactoring where rationale adds value\\n- Tasks where understanding the approach is important\\n- When mentioning unrelated bugs/issues found\\n- Suggesting logical next steps user might want\\n\\n**What to include in verbose answers**:\\n- Brief summary of what was done and why\\n- Key files/functions changed (with `file:line` references)\\n- Any important decisions or tradeoffs made\\n- Next steps or things user should verify\\n- Issues found but not fixed\\n\\n**What to avoid**:\\n- Don't show full file contents unless explicitly asked\\n- Don't explain how to save files or copy code (user has access to your work)\\n- Don't use \\\"Here's what I did\\\" or \\\"Let me know if...\\\" style preambles/postambles\\n- Keep tone direct and factual, like handing off work to a teammate\\n\\n\\n\\nWorking directory: /tmp/crush-test/TestCoderAgent/zai-glm4.6/write_tool\\nIs directory a git repo: no\\nPlatform: linux\\nToday's date: 1/1/2025\\n\\n\\n\\n\\n\\n\\n\",\"role\":\"system\"},{\"content\":\"use write to create a new file called config.json with content '{\\\"name\\\": \\\"test\\\", \\\"version\\\": \\\"1.0.0\\\"}'\",\"role\":\"user\"},{\"content\":\"\\n\",\"tool_calls\":[{\"id\":\"call_19ceb1a698a14e929da1d909\",\"function\":{\"arguments\":\"{\\\"content\\\":\\\"{\\\\\\\"name\\\\\\\": \\\\\\\"test\\\\\\\", \\\\\\\"version\\\\\\\": \\\\\\\"1.0.0\\\\\\\"}\\\",\\\"file_path\\\":\\\"/tmp/crush-test/TestCoderAgent/zai-glm4.6/write_tool/config.json\\\"}\",\"name\":\"write\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"\\nFile successfully written: /tmp/crush-test/TestCoderAgent/zai-glm4.6/write_tool/config.json\\n\",\"tool_call_id\":\"call_19ceb1a698a14e929da1d909\",\"role\":\"tool\"}],\"model\":\"glm-4.6\",\"max_tokens\":10000,\"stream_options\":{\"include_usage\":true},\"tool_choice\":\"auto\",\"tools\":[{\"function\":{\"name\":\"bash\",\"strict\":false,\"description\":\"Executes bash commands in persistent shell session with timeout and security measures.\\n\\n\\nUses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).\\nUse forward slashes for paths: \\\"ls C:/foo/bar\\\" not \\\"ls C:\\\\foo\\\\bar\\\".\\nCommon shell builtins and core utils available on Windows.\\n\\n\\n\\n1. Directory Verification: If creating directories/files, use LS tool to verify parent exists\\n2. Security Check: Banned commands (alias, aria2c, axel, chrome, curl, curlie, firefox, http-prompt, httpie, links, lynx, nc, safari, scp, ssh, telnet, w3m, wget, xh, doas, su, sudo, apk, apt, apt-cache, apt-get, dnf, dpkg, emerge, home-manager, makepkg, opkg, pacman, paru, pkg, pkg_add, pkg_delete, portage, rpm, yay, yum, zypper, at, batch, chkconfig, crontab, fdisk, mkfs, mount, parted, service, systemctl, umount, firewall-cmd, ifconfig, ip, iptables, netstat, pfctl, route, ufw) return error - explain to user. Safe read-only commands execute without prompts\\n3. Command Execution: Execute with proper quoting, capture output\\n4. Output Processing: Truncate if exceeds 30000 characters\\n5. Return Result: Include errors, metadata with tags\\n\\n\\n\\n- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)\\n- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'\\n- Chain with ';' or '&&', avoid newlines except in quoted strings\\n- Shell state persists (env vars, virtual envs, cwd, etc.)\\n- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)\\n\\n\\n\\nWhen user asks to create git commit:\\n\\n1. Single message with three tool_use blocks (IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - git log (recent commit message style)\\n\\n2. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.\\n\\n3. Analyze staged changes in tags:\\n - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)\\n - Brainstorm purpose/motivation, assess project impact, check for sensitive info\\n - Don't use tools beyond git context\\n - Draft concise (1-2 sentences) message focusing on \\\"why\\\" not \\\"what\\\"\\n - Use clear language, accurate reflection (\\\"add\\\"=new feature, \\\"update\\\"=enhancement, \\\"fix\\\"=bug fix)\\n - Avoid generic messages, review draft\\n\\n4. Create commit with Crush signature using HEREDOC:\\n git commit -m \\\"$(cat <<'EOF'\\n Commit message here.\\n\\n \U0001F498 Generated with Crush\\n\\n\\n Co-Authored-By: Crush \\n\\n EOF\\n )\\\"\\n\\n5. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.\\n\\n6. Run git status to verify.\\n\\nNotes: Use \\\"git commit -am\\\" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.\\n\\n\\n\\nUse gh command for ALL GitHub tasks. When user asks to create PR:\\n\\n1. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):\\n - git status (untracked files)\\n - git diff (staged/unstaged changes)\\n - Check if branch tracks remote and is up to date\\n - git log and 'git diff main...HEAD' (full commit history from main divergence)\\n\\n2. Create new branch if needed\\n3. Commit changes if needed\\n4. Push to remote with -u flag if needed\\n\\n5. Analyze changes in tags:\\n - List commits since diverging from main\\n - Summarize nature of changes\\n - Brainstorm purpose/motivation\\n - Assess project impact\\n - Don't use tools beyond git context\\n - Check for sensitive information\\n - Draft concise (1-2 bullet points) PR summary focusing on \\\"why\\\"\\n - Ensure summary reflects ALL changes since main divergence\\n - Clear, concise language\\n - Accurate reflection of changes and purpose\\n - Avoid generic summaries\\n - Review draft\\n\\n6. Create PR with gh pr create using HEREDOC:\\n gh pr create --title \\\"title\\\" --body \\\"$(cat <<'EOF'\\n\\n ## Summary\\n\\n <1-3 bullet points>\\n\\n ## Test plan\\n\\n [Checklist of TODOs...]\\n\\n\\n \U0001F498 Generated with Crush\\n\\n\\n EOF\\n )\\\"\\n\\nImportant:\\n\\n- Return empty response - user sees gh output\\n- Never update git config\\n\\n\\n\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n\\n\",\"parameters\":{\"properties\":{\"command\":{\"description\":\"The command to execute\",\"type\":\"string\"},\"description\":{\"description\":\"A brief description of what the command does\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in milliseconds (max 600000)\",\"type\":\"integer\"}},\"required\":[\"command\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"download\",\"strict\":false,\"description\":\"Downloads binary data from URL and saves to local file.\\n\\n\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n\\n\\n\\n- Downloads any file type (binary or text)\\n- Auto-creates parent directories if missing\\n- Handles large files efficiently with streaming\\n- Sets reasonable timeouts to prevent hanging\\n- Validates input parameters before requests\\n\\n\\n\\n- Max file size: 100MB\\n- Only supports HTTP and HTTPS protocols\\n- Cannot handle authentication or cookies\\n- Some websites may block automated requests\\n- Will overwrite existing files without warning\\n\\n\\n\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The local file path where the downloaded content should be saved\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 600)\",\"type\":\"integer\"},\"url\":{\"description\":\"The URL to download from\",\"type\":\"string\"}},\"required\":[\"url\",\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"edit\",\"strict\":false,\"description\":\"Edits files by replacing text, creating new files, or deleting content. For moving/renaming use Bash 'mv'. For large edits use Write tool.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. For new files: Use LS tool to verify parent directory exists\\n3. **CRITICAL**: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. old_string: Text to replace (must match exactly including whitespace/indentation)\\n3. new_string: Replacement text\\n4. replace_all: Replace all occurrences (default false)\\n\\n\\n\\n\\n- Create file: provide file_path + new_string, leave old_string empty\\n- Delete content: provide file_path + old_string, leave new_string empty\\n \\n\\n\\nEXACT MATCHING: The tool is extremely literal. Text must match **EXACTLY**\\n\\n- Every space and tab character\\n- Every blank line\\n- Every newline character\\n- Indentation level (count the spaces/tabs)\\n- Comment spacing (`// comment` vs `//comment`)\\n- Brace positioning (`func() {` vs `func(){`)\\n\\nCommon failures:\\n\\n```\\nExpected: \\\" func foo() {\\\" (4 spaces)\\nProvided: \\\" func foo() {\\\" (2 spaces) ❌ FAILS\\n\\nExpected: \\\"}\\\\n\\\\nfunc bar() {\\\" (2 newlines)\\nProvided: \\\"}\\\\nfunc bar() {\\\" (1 newline) ❌ FAILS\\n\\nExpected: \\\"// Comment\\\" (space after //)\\nProvided: \\\"//Comment\\\" (no space) ❌ FAILS\\n```\\n\\nUNIQUENESS (when replace_all=false): old_string MUST uniquely identify target instance\\n\\n- Include 3-5 lines context BEFORE and AFTER change point\\n- Include exact whitespace, indentation, surrounding code\\n- If text appears multiple times, add more context to make it unique\\n\\nSINGLE INSTANCE: Tool changes ONE instance when replace_all=false\\n\\n- For multiple instances: set replace_all=true OR make separate calls with unique context\\n- Plan calls carefully to avoid conflicts\\n\\nVERIFICATION BEFORE USING: Before every edit\\n\\n1. View the file and locate exact target location\\n2. Check how many instances of target text exist\\n3. Copy the EXACT text including all whitespace\\n4. Verify you have enough context for unique identification\\n5. Double-check indentation matches (count spaces/tabs)\\n6. Plan separate calls or use replace_all for multiple changes\\n \\n\\n\\nTool fails if:\\n- old_string matches multiple locations and replace_all=false\\n- old_string doesn't match exactly (including whitespace)\\n- Insufficient context causes wrong instance change\\n- Indentation is off by even one space\\n- Missing or extra blank lines\\n- Wrong tabs vs spaces\\n\\n\\n\\nIf you get \\\"old_string not found in file\\\":\\n\\n1. **View the file again** at the specific location\\n2. **Copy more context** - include entire function if needed\\n3. **Check whitespace**:\\n - Count indentation spaces/tabs\\n - Look for blank lines\\n - Check for trailing spaces\\n4. **Verify character-by-character** that your old_string matches\\n5. **Never guess** - always View the file to get exact text\\n \\n\\n\\n\\n- Ensure edits result in correct, idiomatic code\\n- Don't leave code in broken state\\n- Use absolute file paths (starting with /)\\n- Use forward slashes (/) for cross-platform compatibility\\n- Multiple edits to same file: send all in single message with multiple tool calls\\n- **When in doubt, include MORE context rather than less**\\n- Match the existing code style exactly (spaces, tabs, blank lines)\\n \\n\\n\\nBefore submitting an edit, verify:\\n\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if they exist\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3-5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all)\\n- [ ] Copied text character-for-character, not approximated\\n \\n\\n\\n✅ Correct: Exact match with context\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n\\nnew_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n // New validation\\\\n if len(input) > 1000 {\\\\n return errors.New(\\\\\\\"input too long\\\\\\\")\\\\n }\\\\n return nil\\\\n}\\\"\\n```\\n\\n❌ Incorrect: Not enough context\\n\\n```\\nold_string: \\\"return nil\\\" // Appears many times!\\n```\\n\\n❌ Incorrect: Wrong indentation\\n\\n```\\nold_string: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 2 spaces\\n// But file actually has: \\\" if input == \\\\\\\"\\\\\\\" {\\\" // 4 spaces\\n```\\n\\n✅ Correct: Including context to make unique\\n\\n```\\nold_string: \\\"func ProcessData(input string) error {\\\\n if input == \\\\\\\"\\\\\\\" {\\\\n return errors.New(\\\\\\\"empty input\\\\\\\")\\\\n }\\\\n return nil\\\"\\n```\\n\\n\\n\\n\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n \\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"},\"new_string\":{\"description\":\"The text to replace it with\",\"type\":\"string\"},\"old_string\":{\"description\":\"The text to replace\",\"type\":\"string\"},\"replace_all\":{\"description\":\"Replace all occurrences of old_string (default false)\",\"type\":\"boolean\"}},\"required\":[\"file_path\",\"old_string\",\"new_string\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"multiedit\",\"strict\":false,\"description\":\"Makes multiple edits to a single file in one operation. Built on Edit tool for efficient multiple find-and-replace operations. Prefer over Edit tool for multiple edits to same file.\\n\\n\\n1. Use View tool to understand file contents and context\\n2. Verify directory path is correct\\n3. CRITICAL: Note exact whitespace, indentation, and formatting from View output\\n\\n\\n\\n1. file_path: Absolute path to file (required)\\n2. edits: Array of edit operations, each containing:\\n - old_string: Text to replace (must match exactly including whitespace/indentation)\\n - new_string: Replacement text\\n - replace_all: Replace all occurrences (optional, defaults to false)\\n\\n\\n\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- ATOMIC: If any single edit fails, the entire operation fails and no changes are applied.\\n- Ideal for several changes to different parts of same file.\\n\\n\\n\\nAll instructions from the Edit tool documentation apply verbatim to every edit item:\\n- Critical requirements for exact matching and uniqueness\\n- Warnings and common failures (tabs vs spaces, blank lines, brace placement, etc.)\\n- Verification steps before using, recovery steps, best practices, and whitespace checklist\\nUse the same level of precision as Edit. Multiedit often fails due to formatting mismatches—double-check whitespace for every edit.\\n\\n\\n\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are atomic—either all succeed or none are applied.\\n3. Plan sequence carefully: earlier edits change the file content that later edits must match.\\n4. Ensure each old_string is unique at its application time (after prior edits).\\n\\n\\n\\n1. View the file and copy exact text (including whitespace) for each target.\\n2. Check how many instances each old_string has BEFORE the sequence starts.\\n3. Dry-run mentally: after applying edit #N, will edit #N+1 still match? Adjust old_string/new_string accordingly.\\n4. Prefer fewer, larger context blocks over many tiny fragments that are easy to misalign.\\n5. If edits are independent, consider separate multiedit batches per logical region.\\n\\n\\n\\n- Operation fails if any old_string doesn’t match exactly (including whitespace) or equals new_string.\\n- Earlier edits can invalidate later matches (added/removed spaces, lines, or reordered text).\\n- Mixed tabs/spaces, trailing spaces, or missing blank lines commonly cause failures.\\n- replace_all may affect unintended regions—use carefully or provide more context.\\n\\n\\n\\nIf the operation fails:\\n1. Identify the first failing edit (start from top; test subsets to isolate).\\n2. View the file again and copy more surrounding context for that edit.\\n3. Recalculate later old_string values based on the file state AFTER preceding edits.\\n4. Reduce the batch (apply earlier stable edits first), then follow up with the rest.\\n\\n\\n\\n- Ensure all edits result in correct, idiomatic code; don’t leave code broken.\\n- Use absolute file paths (starting with /).\\n- Use replace_all only when you’re certain; otherwise provide unique context.\\n- Match existing style exactly (spaces, tabs, blank lines).\\n- Test after the operation; if it fails, fix and retry in smaller chunks.\\n\\n\\n\\nFor EACH edit, verify:\\n- [ ] Viewed the file first\\n- [ ] Counted indentation spaces/tabs\\n- [ ] Included blank lines if present\\n- [ ] Matched brace/bracket positioning\\n- [ ] Included 3–5 lines of surrounding context\\n- [ ] Verified text appears exactly once (or using replace_all deliberately)\\n- [ ] Copied text character-for-character, not approximated\\n\\n\\n\\n✅ Correct: Sequential edits where the second match accounts for the first change\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n doNew()\\\\n}\\\",\\n },\\n {\\n // Uses context that still exists AFTER the first replacement\\n old_string: \\\"func B() {\\\\n callA()\\\\n}\\\",\\n new_string: \\\"func B() {\\\\n callA()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n❌ Incorrect: Second old_string no longer matches due to whitespace change introduced by the first edit\\n\\n```\\nedits: [\\n {\\n old_string: \\\"func A() {\\\\n doOld()\\\\n}\\\",\\n new_string: \\\"func A() {\\\\n\\\\n doNew()\\\\n}\\\", // Added extra blank line\\n },\\n {\\n old_string: \\\"func A() {\\\\n doNew()\\\\n}\\\", // Missing the new blank line, will FAIL\\n new_string: \\\"func A() {\\\\n doNew()\\\\n logChange()\\\\n}\\\",\\n },\\n]\\n```\\n\\n\",\"parameters\":{\"properties\":{\"edits\":{\"description\":\"Array of edit operations to perform sequentially on the file\",\"items\":{},\"type\":\"array\"},\"file_path\":{\"description\":\"The absolute path to the file to modify\",\"type\":\"string\"}},\"required\":[\"file_path\",\"edits\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"glob\",\"strict\":false,\"description\":\"Fast file pattern matching tool that finds files by name/pattern, returning paths sorted by modification time (newest first).\\n\\n\\n- Provide glob pattern to match against file paths\\n- Optional starting directory (defaults to current working directory)\\n- Results sorted with most recently modified files first\\n\\n\\n\\n- '\\\\*' matches any sequence of non-separator characters\\n- '\\\\*\\\\*' matches any sequence including separators\\n- '?' matches any single non-separator character\\n- '[...]' matches any character in brackets\\n- '[!...]' matches any character not in brackets\\n\\n\\n\\n- '*.js' - JavaScript files in current directory\\n- '**/*.js' - JavaScript files in any subdirectory\\n- 'src/**/*.{ts,tsx}' - TypeScript files in src directory\\n- '*.{html,css,js}' - HTML, CSS, and JS files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Does not search file contents (use Grep for that)\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Path separators handled automatically (/ and \\\\ work)\\n- Uses ripgrep (rg) if available, otherwise Go implementation\\n- Patterns should use forward slashes (/) for compatibility\\n\\n\\n\\n- Combine with Grep: find files with Glob, search contents with Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine pattern if needed\\n\\n\",\"parameters\":{\"properties\":{\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The glob pattern to match files against\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"grep\",\"strict\":false,\"description\":\"Fast content search tool that finds files containing specific text/patterns, returning matching paths sorted by modification time (newest first).\\n\\n\\n- Provide regex pattern to search within file contents\\n- Set literal_text=true for exact text with special characters (recommended for non-regex users)\\n- Optional starting directory (defaults to current working directory)\\n- Optional include pattern to filter which files to search\\n- Results sorted with most recently modified files first\\n\\n\\n\\nWhen literal_text=false (supports standard regex):\\n\\n- 'function' searches for literal text \\\"function\\\"\\n- 'log\\\\..\\\\*Error' finds text starting with \\\"log.\\\" and ending with \\\"Error\\\"\\n- 'import\\\\s+.\\\\*\\\\s+from' finds import statements in JavaScript/TypeScript\\n\\n\\n\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n\\n\\n\\n- Results limited to 100 files (newest first)\\n- Performance depends on number of files searched\\n- Very large binary files may be skipped\\n- Hidden files (starting with '.') skipped\\n\\n\\n\\n- Respects .gitignore patterns to skip ignored files/directories\\n- Respects .crushignore patterns for additional ignore rules\\n- Both ignore files auto-detected in search root directory\\n\\n\\n\\n- Uses ripgrep (rg) if available for better performance\\n- Falls back to Go implementation if ripgrep unavailable\\n- File paths normalized automatically for compatibility\\n\\n\\n\\n- For faster searches: use Glob to find relevant files first, then Grep\\n- For iterative exploration requiring multiple searches, consider Agent tool\\n- Check if results truncated and refine search pattern if needed\\n- Use literal_text=true for exact text with special characters (dots, parentheses, etc.)\\n\\n\",\"parameters\":{\"properties\":{\"include\":{\"description\":\"File pattern to include in the search (e.g. \\\"*.js\\\", \\\"*.{ts,tsx}\\\")\",\"type\":\"string\"},\"literal_text\":{\"description\":\"If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.\",\"type\":\"boolean\"},\"path\":{\"description\":\"The directory to search in. Defaults to the current working directory.\",\"type\":\"string\"},\"pattern\":{\"description\":\"The regex pattern to search for in file contents\",\"type\":\"string\"}},\"required\":[\"pattern\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"ls\",\"strict\":false,\"description\":\"Shows files and subdirectories in tree structure for exploring project organization.\\n\\n\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n\\n\\n\\n- Hierarchical view of files and directories\\n- Auto-skips hidden files/directories (starting with '.')\\n- Skips common system directories like __pycache__\\n- Can filter files matching specific patterns\\n\\n\\n\\n- Results limited to 1000 files\\n- Large directories truncated\\n- No file sizes or permissions shown\\n- Cannot recursively list all directories in large projects\\n\\n\\n\\n- Hidden file detection uses Unix convention (files starting with '.')\\n- Windows hidden files (with hidden attribute) not auto-skipped\\n- Common Windows directories (System32, Program Files) not in default ignore\\n- Path separators handled automatically (/ and \\\\ work)\\n\\n\\n\\n- Use Glob for finding files by name patterns instead of browsing\\n- Use Grep for searching file contents\\n- Combine with other tools for effective exploration\\n\\n\",\"parameters\":{\"properties\":{\"depth\":{\"description\":\"The maximum depth to traverse\",\"type\":\"integer\"},\"ignore\":{\"description\":\"List of glob patterns to ignore\",\"items\":{},\"type\":\"array\"},\"path\":{\"description\":\"The path to the directory to list (defaults to current working directory)\",\"type\":\"string\"}},\"required\":[],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"sourcegraph\",\"strict\":false,\"description\":\"Search code across public repositories using Sourcegraph's GraphQL API.\\n\\n\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n\\n\\n\\n- \\\"fmt.Println\\\" - exact matches\\n- \\\"file:.go fmt.Println\\\" - limit to Go files\\n- \\\"repo:^github\\\\.com/golang/go$ fmt.Println\\\" - specific repos\\n- \\\"lang:go fmt.Println\\\" - limit to Go code\\n- \\\"fmt.Println AND log.Fatal\\\" - combined terms\\n- \\\"fmt\\\\.(Print|Printf|Println)\\\" - regex patterns\\n- \\\"\\\\\\\"exact phrase\\\\\\\"\\\" - exact phrase matching\\n- \\\"-file:test\\\" or \\\"-repo:forks\\\" - exclude matches\\n\\n\\n\\nRepository: repo:name, repo:^exact$, repo:org/repo@branch, -repo:exclude, fork:yes, archived:yes, visibility:public\\nFile: file:\\\\.js$, file:internal/, -file:test, file:has.content(text)\\nContent: content:\\\"exact\\\", -content:\\\"unwanted\\\", case:yes\\nType: type:symbol, type:file, type:path, type:diff, type:commit\\nTime: after:\\\"1 month ago\\\", before:\\\"2023-01-01\\\", author:name, message:\\\"fix\\\"\\nResult: select:repo, select:file, select:content, count:100, timeout:30s\\n\\n\\n\\n- \\\"file:.go context.WithTimeout\\\" - Go code using context.WithTimeout\\n- \\\"lang:typescript useState type:symbol\\\" - TypeScript React useState hooks\\n- \\\"repo:^github\\\\.com/kubernetes/kubernetes$ pod list type:file\\\" - Kubernetes pod files\\n- \\\"file:Dockerfile (alpine OR ubuntu) -content:alpine:latest\\\" - Dockerfiles with base images\\n\\n\\n\\n- \\\"term1 AND term2\\\" - both terms\\n- \\\"term1 OR term2\\\" - either term\\n- \\\"term1 NOT term2\\\" - term1 but not term2\\n- \\\"term1 and (term2 or term3)\\\" - grouping with parentheses\\n\\n\\n\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n\\n\\n\\n- Use specific file extensions to narrow results\\n- Add repo: filters for targeted searches\\n- Use type:symbol for function/method definitions\\n- Use type:file to find relevant files\\n\\n\",\"parameters\":{\"properties\":{\"context_window\":{\"description\":\"The context around the match to return (default: 10 lines)\",\"type\":\"integer\"},\"count\":{\"description\":\"Optional number of results to return (default: 10, max: 20)\",\"type\":\"integer\"},\"query\":{\"description\":\"The Sourcegraph search query\",\"type\":\"string\"},\"timeout\":{\"description\":\"Optional timeout in seconds (max 120)\",\"type\":\"integer\"}},\"required\":[\"query\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"view\",\"strict\":false,\"description\":\"Reads and displays file contents with line numbers for examining code, logs, or text data.\\n\\n\\n- Provide file path to read\\n- Optional offset: start reading from specific line (0-based)\\n- Optional limit: control lines read (default 2000)\\n- Don't use for directories (use LS tool instead)\\n\\n\\n\\n- Displays contents with line numbers\\n- Can read from any file position using offset\\n- Handles large files by limiting lines read\\n- Auto-truncates very long lines for display\\n- Suggests similar filenames when file not found\\n\\n\\n\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n\\n\\n\\n- Handles Windows (CRLF) and Unix (LF) line endings\\n- Works with forward slashes (/) and backslashes (\\\\)\\n- Auto-detects text encoding for common formats\\n\\n\\n\\n- Use with Glob to find files first\\n- For code exploration: Grep to find relevant files, then View to examine\\n- For large files: use offset parameter for specific sections\\n\\n\",\"parameters\":{\"properties\":{\"file_path\":{\"description\":\"The path to the file to read\",\"type\":\"string\"},\"limit\":{\"description\":\"The number of lines to read (defaults to 2000)\",\"type\":\"integer\"},\"offset\":{\"description\":\"The line number to start reading from (0-based)\",\"type\":\"integer\"}},\"required\":[\"file_path\"],\"type\":\"object\"}},\"type\":\"function\"},{\"function\":{\"name\":\"write\",\"strict\":false,\"description\":\"Creates or updates files in filesystem for saving/modifying text content.\\n\\n\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n\\n\\n\\n- Creates new files or overwrites existing ones\\n- Auto-creates parent directories if missing\\n- Checks if file modified since last read for safety\\n- Avoids unnecessary writes when content unchanged\\n\\n\\n\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n\\n\\n\\n- Use forward slashes (/) for compatibility\\n\\n\\n\\n- Use View tool first to examine existing files before modifying\\n- Use LS tool to verify location when creating new files\\n- Combine with Glob/Grep to find and modify multiple files\\n- Include descriptive comments when changing existing code\\n\\n\",\"parameters\":{\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"file_path\":{\"description\":\"The path to the file to write\",\"type\":\"string\"}},\"required\":[\"file_path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}" headers: Accept: - application/json @@ -110,27 +110,25 @@ interactions: proto_minor: 0 content_length: -1 body: |+ - data: {"id":"2025102904095743ab5fa4c9644d58","created":1761682197,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} + data: {"id":"202510291832491f4e1ed8964246ea","created":1761733969,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning_content":"\n"}}]} - data: {"id":"2025102904095743ab5fa4c9644d58","created":1761682197,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} + data: {"id":"202510291832491f4e1ed8964246ea","created":1761733969,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"\n"}}]} - data: {"id":"2025102904095743ab5fa4c9644d58","created":1761682197,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Created"}}]} + data: {"id":"202510291832491f4e1ed8964246ea","created":1761733969,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"Created"}}]} - data: {"id":"2025102904095743ab5fa4c9644d58","created":1761682197,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" config"}}]} + data: {"id":"202510291832491f4e1ed8964246ea","created":1761733969,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" config"}}]} - data: {"id":"2025102904095743ab5fa4c9644d58","created":1761682197,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".json"}}]} + data: {"id":"202510291832491f4e1ed8964246ea","created":1761733969,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":".json"}}]} - data: {"id":"2025102904095743ab5fa4c9644d58","created":1761682197,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} + data: {"id":"202510291832491f4e1ed8964246ea","created":1761733969,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" with"}}]} - data: {"id":"2025102904095743ab5fa4c9644d58","created":1761682197,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" the"}}]} + data: {"id":"202510291832491f4e1ed8964246ea","created":1761733969,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" specified"}}]} - data: {"id":"2025102904095743ab5fa4c9644d58","created":1761682197,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" specified"}}]} + data: {"id":"202510291832491f4e1ed8964246ea","created":1761733969,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" content"}}]} - data: {"id":"2025102904095743ab5fa4c9644d58","created":1761682197,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":" content"}}]} + data: {"id":"202510291832491f4e1ed8964246ea","created":1761733969,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} - data: {"id":"2025102904095743ab5fa4c9644d58","created":1761682197,"model":"glm-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"."}}]} - - data: {"id":"2025102904095743ab5fa4c9644d58","created":1761682197,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10685,"completion_tokens":13,"total_tokens":10698,"prompt_tokens_details":{"cached_tokens":10530}}} + data: {"id":"202510291832491f4e1ed8964246ea","created":1761733969,"model":"glm-4.6","choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":10387,"completion_tokens":12,"total_tokens":10399,"prompt_tokens_details":{"cached_tokens":10232}}} data: [DONE] @@ -139,4 +137,4 @@ interactions: - text/event-stream;charset=UTF-8 status: 200 OK code: 200 - duration: 687.672958ms + duration: 812.113458ms